<!DOCTYPE html>
<html>
  <head>
    <title>为您服务的是工具大师</title>
    <meta charset="utf-8">
	<style>
		/*周边不留缝隙*/
		body{margin: 0;}
	</style>
  </head>
  <body>
	<script type="text/javascript" src="../libs/minicomps.min.js"></script>
	<script type="text/javascript" src="../libs/FileSaver.js"></script>
	<script type="text/javascript" src="../libs/Box2dWeb-2.1.a.3.min.js"></script>
	<script type="text/javascript" src="../libs/moonBox2d.js"></script>
	<script type="text/javascript" src="../libs/easeljs.js"></script>
	<script type="text/javascript" src="../libs/helpWindow.js"></script>
	<script type="text/javascript" src="../libs/Unify.js"></script>
	<script type="text/javascript" src="../libs/md5.js"></script>
	<script type="text/javascript" src="../libs/canvas2image.js"></script>
	<script type="text/javascript" src="../libs/conversion.js"></script>
	<script type="text/javascript" src="../libs/createui.js"></script>
	<script type="text/javascript" src="../libs/jscolor.min.js"></script>
	<script type="text/javascript" src="../libs/TweenMax.min.js"></script>
	<script type="text/javascript" src="../libs/TimeFactory.min.js"></script>
	<script type="text/javascript" src="../libs/qrcode.js"></script>
	<script type="text/javascript" src="../libs/day.min.js"></script>
	<!-- 控制声音的组件 start-->
	<audio id='soundEffct_1' controls="controls" autobuffer="autobuffer" hidden="true">
		<source src="data:audio/mpeg;base64,SUQzAwAAAAACQFRTU0UAAAA0AAAAQXVkaW9FbmNvZGVyIENvcHlyaWdodChDKSAxOTk5LTIwMDMgS2F6dWtpIE9pa2F3YS4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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SJ0AXGkS0piWBpKPWLUAy63W+Arfc2ZAqmr1xViYAJRWgI4+ibBclKcQcEFKlhOhJupiIynCzP0Ruk7RzN6xFQR0WWowgeANZMj4M+Yho/ZZRrxjFIQFCC2tbSa6zAsNIWeSmIKaigAAAA//tQYAADMW8QTPsPYhgq4em/ZekpROw/McwwzGCrB+a5h6VNEGNoRnaMAAAAFoAYIlRmQ6wLjT2CFm0iHEEMkdFejyaLR/LQJcy8lgseu4WI6oEojwzq/AAAAAwKdQiVrhMVDrhGzMuUZSCIHSNxTF1WkrIegdxmaar6LJSBiSGZ1ZIYaeArszJHIEXLDjIq1FZh4LarCLtXhC9CPOspDrtFelQQQry8O8voRFJhPGFmEU08hIsVVKgPIkto30+qSTKl53bYRoUycXTJMM42mP/7UGAAAzFDDs1zDxo6KMG5nmMMJ0RwLTPMPMioiQakkYClxTB0d4eHgAAAIAiRkyIwX6MBWeiRC6TIjwNRZGCJ0Z6ajaRFpaMmgqLKEPEQ0O4AAAKwXOhZLADRO0SUHXgAgEu9fsTRMfgLCUM+g2zq5rHmhRgyPERDun6VsQxtFUaaLKC9IsVbKPRlC5ErEVa1GWFueROk6BVLIZI8DrA0KxhkAGC37Imqu0pit2swmGmjVlxh+jqaQzaYgpqKZlxyclxqAAAAAAAAAAAAAABUQUcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlA==" />
	</audio>
	<div id='soundControl' style='position:absolute;left:10px;top:10px;'>
		<audio id='audio' style='width:600px;' src="" controls="controls" preload autoplay></audio>
		<br>
		<div style='height:500px;width:600px;background-color:#444444;color:#ffffff;'>
			把声音文件拖到这里面
			<br>
			<div id='btnDiv'>

			</div>
		</div>
	</div>
	<!-- 控制声音的组件 end-->
	<!-- 控制视频的组件 start-->
	<div id='videoControl' style='position:absolute;left:10px;top:10px'>
		<video id='video' style='height:500px;width:600px;background-color:#444444;' src="" controls="controls" preload autoplay></video>
		<div style='height:100px;width:600px;background-color:#444444;color:#ffffff;'>
			把视频文件拖到这里面   (支持格式mp4,webm,ogg)
			<div id='btnDiv2'>
			</div>
		</div>
	</div>
	<!-- 控制视频的组件 end-->
	<!-- 普通拖入组件 start-->
	<div id='dragDiv' style='position:absolute;left:10px;top:10px;'>
		<div style='height:500px;width:600px;background-color:#444444;color:#ffffff;'>
			把文件拖到这里面
		</div>
	</div>
	<!-- 普通拖入组件 end-->
	<div id='colorDiv' style='position:absolute;left:10px;top:10px;'>
		<h3>颜色选择-无透明</h3>Color: <input value="3399FF" data-jscolor="{onInput:'updateColor(this)'}">
		<h3>颜色选择-有透明</h3>Color: <input value="3399FF80" data-jscolor="{}">
	</div>
	<!-- 画二维码用-->
	<div id='orcode' style='position:absolute;left:10px;top:10px'></div>
	<script>
	const { Toggle, HSlider,VSlider,Panel, Canvas ,Button,TextArea,TextBox,TextInput,Label,Window,LabelInput,TipsManager,RadioButton,ColorPicker,TabbarWindow,Checkbox,Knob,Stage,MoonTextArea,Dropdown,TabbarButton,ProgressBar} = mc
	const width = Stage.width;
	const height = Stage.height-30;
	const Const={UP:'上',DOWN:'下',LEFT:'左',RIGHT:'右',STOP:'停'};
	const ConstKey={W:'w',S:'s',A:'a',D:'d'};
	const panel = new Panel(document.body, 0, 0, width,height);
	const soundEffct_1=document.getElementById("soundEffct_1")
	var group=1;
	jscolor.presets.default = {//颜色默认显示的色块
		palette: [
			'#000000', '#7d7d7d', '#870014', '#ec1c23', '#ff7e26', '#fef100', '#22b14b', '#00a1e7', '#3f47cc', '#a349a4',
			'#ffffff', '#c3c3c3', '#b87957', '#feaec9', '#ffc80d', '#eee3af', '#b5e61d', '#99d9ea', '#7092be', '#c8bfe7',
		]
	}
	function updateColor(t){
		//console.log(t.toRGBString(),t.toString());
		if(currPanel&&currPanel.updateColor){
			currPanel.updateColor(t);
		}
	}


	const helper=new HelpWindow(width,height);

	Unify.loadJs('../libs/jsToolGameDemo.js');

	/**数字格式，把小于10的数在前面加个0*/
	function numberFormat(num){
		if(num>=10)			return String(num);
		else				return "0"+num;
	}
	/**复制行数*/
	function copyString(input){
		input.select();
		document.execCommand('Copy');
		TipsManager.alert('复制成功');
	}
	/**键盘事件*/
	window.keyDownData={};
	window.keyUpData={};
	window.addEventListener('keydown', keyDownCb,true);
	window.addEventListener('keyup', keyUpCb,true);
	function keyDownCb(e){
		//console.log(e.keyCode);
		for( var i in window.keyDownData){
			window.keyDownData[i](e);
		}
	}
	function keyUpCb(e){
		for( var i in window.keyUpData){
			window.keyUpData[i](e);
		}
	}
	//新把组件删除后面再加入
	var btnDiv=document.getElementById('btnDiv');
	var audio=document.getElementById('audio');
	var soundControl = document.getElementById('soundControl');
	document.body.removeChild(soundControl);

	var btnDiv2=document.getElementById('btnDiv2');
	var video=document.getElementById('video');
	var videoControl = document.getElementById('videoControl');
	document.body.removeChild(videoControl);

	var dragDiv=document.getElementById('dragDiv');
	document.body.removeChild(dragDiv);

	var orcode=document.getElementById('orcode');
	document.body.removeChild(orcode);

	//基础面板
	class BasicPanel {
		constructor(label){
			this.isShow=true;
            this.p=new Canvas(document.body, 100, 30,width-110,height-30);
			this.p.setColorDark();
			new Label(this.p,5,-15,label).setBold(true).setFontSize(15);
		}
		set visible(value){//复盖父级方法
			if(this.isShow!=value){
				if(value) this.p.addFromParent();
				else	  this.p.removeFromParent();
			}
			this.isShow=value;
		}
		initData(){//子类去实现

		}
		setData(data){//子类去实现

		}
		setDataWindow(){
			this.dataWindow=new Window(this.p,0,0,window.innerWidth-150,window.innerHeight-100);
			this.dataWindow.visible=false;
			this.dataText=new MoonTextArea(this.dataWindow,0,22).setSize(this.dataWindow.width,this.dataWindow.height);
			this.dataWindow.btnClose=new Button(this.dataWindow,0,0,'复制关闭窗口',(e)=>{
				copyString(this.dataText.input);
				this.dataWindow.visible=false;
			});
			this.dataWindow.setContent=(str)=>{
				this.dataWindow.visible=true;
				this.dataText.text=str;
			}
		}
	}
	//-----------------时间类面板-----------------
	class TimePanel extends BasicPanel{
		constructor(label){
			super(label);
			
			let x,y;
			this.timeToDate={};
			for(let i=0;i<7;i++){
				let y=40+30*i;
				let txtInput=new TextInput(this.p,10,y,'',this.onTimeToDate.bind(this)).setSize(150,20);
				new Label(this.p,165,y+3,'毫秒转日期');
				let txtOut=new TextInput(this.p,230,y);
				txtOut.setSize(150,20);
				txtInput.name=i;
				this.timeToDate[txtInput.name]=txtOut;
			}
			
			this.dateToTime={};
			for(let i=0;i<7;i++){
				let y=40+30*i;
				let x=450;
				let txtInput=new TextInput(this.p,10+x,y,'',this.onDateToTime.bind(this)).setSize(150,20);
				new Label(this.p,165+x,y+3,'日期转毫秒');
				let txtOut=new TextInput(this.p,230+x,y);
				txtOut.setSize(150,20);
				txtInput.name=i;
				this.dateToTime[txtInput.name]=txtOut;
			}

			[x,y]=[900,30]
			new Label(this.p,x,y+3,'输入时间(毫秒/日期)')
			this.txtDay1=new TextInput(this.p,x+120,y,'',this.onUpdateDay12.bind(this)).setSize(150,20);
			new Button(this.p,x+280,y,'重置',this.onUpdateDay12.bind(this))
			this.txtDay2=new TextInput(this.p,x+120,y+=30,'').setSize(150,20);


			let tobNames=['年','月','周','日','时','分','秒','毫秒'];
			let tobTypes=['year','month','week','day','hour','minute','second','millisecond'];
			this.type=tobTypes[0];
			this.currTimer=0;
			this.fmt='YYYY-MM-DD HH:mm:ss';
			y+=30;
			this.inputNum=new LabelInput(this.p,x,y,'输入数字');
			this.inputNum.input.text='1';
			y+=30;
			for(i=0;i<tobNames.length;i++){
				new RadioButton(this.p,x+i*50,y+3,1,tobNames[i],i==0,(e)=>{
					this.type=tobTypes[tobNames.indexOf(e.detail)];
				});
			}
			y+=30;
			var addSubNames=['增加','减少'];
			for(i=0;i<addSubNames.length;i++){
				new Button(this.p,x+i*100,y,addSubNames[i],this.onAddSub.bind(this)).name=String(i);
			}
			y+=30;
			addSubNames=['时间的开始','时间的末尾'];
			for(i=0;i<addSubNames.length;i++){
				new Button(this.p,x+i*100,y,addSubNames[i],this.onStaEnd.bind(this)).name=String(i);
			}
			
			this.txtArea1=new TextArea(this.p,10,270,'把json格式数据拷贝进来',this.onTxtArea.bind(this)).setSize(300,400);
			this.txtArea2=new TextArea(this.p,315,270).setSize(300,400);
			//本地时间
			this.setLocalTime();
			
			x=650;
			y=280;
			new TextInput(this.p,x,y,'',this.onTimeToDownTime.bind(this)).setSize(150,20);
			new Label(this.p,x+155,y+3,'毫秒转倒计时');
			this.txtDownTime=new TextInput(this.p,x+230,y).setSize(150,20);
			
			y=320;
			new TextInput(this.p,x,y,'',this.onTimeToDownTime2.bind(this)).setSize(150,20);
			new Label(this.p,x+155,y+3,'毫秒转成时间');
			this.txtDownTime2=new TextInput(this.p,x+230,y).setSize(150,20);

			y=360;
			new TextInput(this.p,x,y,'',this.onTimeToDownTime3.bind(this)).setSize(150,20);
			new Label(this.p,x+155,y+3,'把秒转成时间');
			this.txtDownTime3=new TextInput(this.p,x+230,y).setSize(150,20);

			y=380;
			new LabelInput(this.p,x,y+=22,'一年的毫秒').input.text=365*24*3600*1000;
			new LabelInput(this.p,x,y+=22,'30天毫秒').input.text=30*24*3600*1000;
			new LabelInput(this.p,x,y+=22,'一周的毫秒').input.text=7*24*3600*1000;
			new LabelInput(this.p,x,y+=22,'一天的毫秒').input.text=24*3600*1000;
			new LabelInput(this.p,x,y+=22,'一小时毫秒').input.text=3600*1000;
			new LabelInput(this.p,x,y+=22,'一分钟毫秒').input.text=60*1000;
			new LabelInput(this.p,x,y+=22,'一秒钟毫秒').input.text=1000;
		}
		onUpdateDay12(){
			this.currTimer=this.txtDay1.text;
			let fmt=this.fmt
			let code=this.getDayCode();
			code=`${code}.format('${fmt}')`;
			this.txtDay2.text=eval(code);
		}
		//增加和减少
		onAddSub(e){
			var addSubs=['add','subtract'];
			let fmt=this.fmt
			var fun=addSubs[e.target.name];
			var num=this.inputNum.input.text;
			num=isNaN(num)?0:num;
			let code=this.getDayCode();
			code=`${code}.${fun}(${num},'${this.type}')`;
			code=`${code}.format('${fmt}')`;
			this.txtDay2.text=eval(code);
			this.currTimer=new Date(this.txtDay2.text).getTime();
			//console.log(this.currTimer)
		}
		//开始和结束
		onStaEnd(e){
			var addSubs=['startOf','endOf'];
			let fmt=this.fmt
			var fun=addSubs[e.target.name];
			let code=this.getDayCode();
			code=`${code}.${fun}('${this.type}')`;
			code=`${code}.format('${fmt}')`;
			this.txtDay2.text=eval(code);
			this.currTimer=new Date(this.txtDay2.text).getTime();
			//console.log(this.currTimer)
		}
		//通过输入值得到dayjs代码
		getDay(day){
			day=day?isNaN(day)?`dayjs('${day}')`:`dayjs(${day})`:`dayjs()`;
			return day;
		}
		//得到dayjs代码
		getDayCode(time=null){
			let day=this.getDay(this.currTimer);
			if(time){
				this.currTimer=dayjs(time).valueOf();
				day=`dayjs(${currTimer})`;
			}else{
				this.currTimer=eval(`${day}.valueOf();`);
			}
			return day;
		}
		onTimeToDate(e){
			let date=new Date(parseInt(e.detail));
			//console.log(date,e.detail);
			let txtOut=this.timeToDate[e.target.name];
			txtOut.text=this.getDate(date);
		}
		onDateToTime(e){
			let date=new Date(e.detail);
			//console.log(date,e.detail);
			let txtOut=this.dateToTime[e.target.name];
			txtOut.text=date.getTime();
		}
		onTimeToDownTime(e){
			let time=parseInt(e.detail)-parseInt(this.t2.text);
			time=parseInt((time>0?time:0)/1000);
			this.onTimeToFormat(time,this.txtDownTime)
		}
		onTimeToDownTime2(e){
			let time=parseInt(e.detail/1000);
			this.onTimeToFormat(time,this.txtDownTime2)
		}
		onTimeToDownTime3(e){
			let time=parseInt(e.detail);
			this.onTimeToFormat(time,this.txtDownTime3)
		}
		onTimeToFormat(time,txtDownTime){
			if(isNaN(time)) time=0;
			if(time>=0){
				let yearSecond=31536000;//一年的秒数
				let daySecond=86400;//一天的秒数
				let year=Math.floor(time/yearSecond);
				let day=Math.floor(time/daySecond);
				if(year>0){
					day=Math.floor((time-year*yearSecond)/daySecond);
					txtDownTime.text=year+'年'+day+'天';
				}else{
					let hours=parseInt((time-(day*daySecond))/3600);
					let minute=parseInt((time-(day*daySecond)-(hours*3600))/60);
					let second=parseInt((time-(day*daySecond)-(hours*3600)-(minute*60)));
					day=day>0?day+'天 ':'';
					txtDownTime.text=day+numberFormat(hours)+':'+numberFormat(minute)+':'+numberFormat(second);
				}
			}
		}
		onTxtArea(e){
			try{
				var o=JSON.parse(e.detail);
				this.txtArea2.text='';
				for(var k in o){
					var num=o[k];
					if(num>9999999){
						var date=new Date(num);
						this.txtArea2.text+=k+':'+this.getDate(date)+'\n';
					}
				}
			}catch(e){
				console.warn('json格式错误');
			}
		}
		getDate(date){
			return date.getFullYear()+'-'+numberFormat(date.getMonth()+1)+'-'+numberFormat(date.getDate())+' '+numberFormat(date.getHours())+':'+numberFormat(date.getMinutes())+':'+numberFormat(date.getSeconds());
		}
		setLocalTime(){
			new Label(this.p,10,10,'本地时间');
			this.t1=new Label(this.p,60,10,'');
			this.t2=new TextInput(this.p,200,8,'');
			this.update();
			new Button(this.p,310,8,'复制',(e)=>{
				copyString(this.t2.input)
			}).setSize(60,20);
		}
		update(){
			let date=new Date();
			this.t1.text=this.getDate(date);
			this.t2.text=date.getTime();
			setTimeout(this.update.bind(this),1000);
		}
	}
	//-----------------激活码生成类面板-----------------
	class ActiveCodePanel extends BasicPanel{
		constructor(label){
			super(label);
			let x=650;
			let y=10;
			new Label(this.p,x,y,'输入要生成的激活码个数');
			this.txt1=new TextInput(this.p,x,y+=25,'100');
			new Label(this.p,x,y+=40,'输入单个激活码位数');
			this.txt2=new TextInput(this.p,x,y+=25,'15');
			
			new Label(this.p,x,y+=40,'----附加条件---uid设定是(4399+当年年份)如43992020----')
			new Label(this.p,x,y+=40,'系统uid(4399+年)');
			this.txt3=new TextInput(this.p,x,y+=25,'');
			new Label(this.p,x,y+=40,'开始-结束(1-11)');
			this.txt4=new TextInput(this.p,x,y+=25,'');
			new Button(this.p,x,y+=40,'开始生成',this.onSave.bind(this));

			
			new Label(this.p,x,y+=60,'解码');
			this.txt5=new TextInput(this.p,x,y+=25,'');
			new Button(this.p,x,y+=40,'开始解码',this.onDecode.bind(this));

			this.loadFile()
		}
		loadFile(){
			var dragDiv9=dragDiv.cloneNode(true);
			let win9=this.p;
			win9.addChild(dragDiv9);
			new Label(this.p,10,520,'对JSON的id做md5的加密运算');
			dragDiv9.ondragover =  (e)=> {
				e.preventDefault();
			}
			dragDiv9.ondrop =  (e)=> {
				e.preventDefault();
				let files=e.dataTransfer.files;
				for(var i=0;i<files.length;i++){
					this.dataToData(files[i]);
				}
			}
		}
		
		dataToData(file){
			var reader = new FileReader();  
			reader.onload = function() {
				let result=this.result;
				let names=this.file.name.split('.');
				let [name,type]=names;
				let json=JSON.parse(result);
				//console.log(json);
				var newJson={};
				for(var key in json){
					var o=json[key];
					//console.log(o)
					var id=md5(String(o.id))
					o.id=id;
					newJson[id]=o;
				}
				//console.log(newJson);
				var content=JSON.stringify(newJson);
				//console.log(content);
				var file = new File([content], "这是一个加密的JSON文件.json", { type: "text/plain;charset=utf-8" })
				saveAs(file)
			}
			reader.file=file;
			reader.readAsText(file);
		}
		onSave(){
			var keys="23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz";
			var cdkeys={};
			var key;
			var k=0;
			var total=parseInt(this.txt1.text);
			var len=parseInt(this.txt2.text);
			this.subjoin(this.txt3.text,this.txt4.text);
			for(var i=0;i<total;i++){
				key="";
				if(this.uid==''){
					for(var j=0;j<len;j++){
						key+=keys[parseInt(Math.random()*keys.length)];
					}
				}else{
					if(this.startEnd.length>0){
						key=this.encrypt();
					}else{
						alert("开始－结束不能为空");
						return;
					}
				}
				if(!cdkeys[key]){
					cdkeys[key]=key;
					k++;
				}
			}
			alert("一共生成了"+k+"个cdkey");
			var content=""
			for(var key in cdkeys){
				content+=key+"\n";
			}
			
			var file = new File([content], "激活码.txt", { type: "text/plain;charset=utf-8" })
			saveAs(file)
		}
		onDecode(){
			alert(Unify.decryptBy32(this.txt5.text));
		}
		encrypt(){
			return Unify.encrytBy32(this.startEndByIndex(),(++this.keyNum),parseInt(this.uid));
		}
		subjoin(uid,startEnd){
			this.startEnd=[];
			this.startEndPos=0;
			this.keyNum=0;
			this.uid=uid;
			if(startEnd!=""){
				var arr=startEnd.split("-");
				var [s,e]=arr;
				for(var i=s;i<=e;i++) this.startEnd.push(i);
			}
		}
		startEndByIndex(){
			var value=0;
			if(this.startEnd.length>0){
				value=this.startEnd[this.startEndPos++];
				if(this.startEndPos==this.startEnd.length) this.startEndPos=0;
			}
			return value;
		}
	}
	//-----------------各种小工具面板-----------------
	class MinToolPanel extends BasicPanel{
		constructor(label){
			super(label);
			this.setDataWindow();
			let labels=['小工具1','进制之间转换','在线写JS','JSON格式化','Excel转Json','计时与倒计时','声音控制','视频控制','数据转换','重命名','制作JSON','制作二维码','其它工具'];
			let tabWin=new TabbarWindow(this.p,0,0,labels,this.p.width,this.p.height,2);
			tabWin.setColor('#EEEEEE');
			let [i,j,k,n,m]=[0,0,0,0,0];
			//--win0-1-----------------------------------
			let win0=tabWin.getWindow(0);
			let x=10;
			let y=10;
			let hasEmpty=true;
			new Label(win0,x,y,'1.输入字符串得到字符串的字数');
			let labelInput=new TextInput(win0,x,y+25,'',(e)=>{
				textFromat();
			})
			let labelLen=new Label(win0,x+105,y+27,'0');
			y=70;
			
			let g=++group;
			let arr=['包括空格','不包括空格'];
			for(let i=0;i<arr.length;i++){
				new RadioButton(win0, x+i*80, y, g, arr[i], i==0, (e)=>{
					if(e.detail==arr[0]){
						hasEmpty=true;
						textFromat();
					}else{
						hasEmpty=false;
						textFromat();
					}
				});
			}
			function textFromat(){
				if(hasEmpty)	labelLen.text=labelInput.text.length;
				else 			labelLen.text=labelInput.text.replace(/\s*/g,"").length;
			}
			y=140;
			new Label(win0,x,y+25+2,'md5加密');
			let md5Out=new TextInput(win0,x+400,y+25,'').setSize(300,20);
			new TextInput(win0,x+55,y+25,'',(e)=>{md5Out.text=md5(e.detail)}).setSize(300,20);
			new Label(win0,x+720,y+25,'md5加密后无法解密');
			// y=200;
			// new Label(win0,x,y+25,'md5解密');//解密网站https://www.cmd5.com/
			// let md5Out2=new TextInput(win0,x+400,y+25,'').setSize(300,20);
			// new TextInput(win0,x+55,y+25,'',(e)=>{md5Out2.text=md5(e.detail)}).setSize(300,20);
			//--win0-2--
			y=15;
			x=250
			new Label(win0,x,y,'2.输入HTML格式得到结果');
			let txtAreaHtml=new TextArea(win0,x,y+25,"<font color='#ff0000' size='3'>标题</font></br><font color='#0000ff'>内容</font>",(e)=>{
				txtBoxHtml.text=e.target.text;
			}).setSize(500,100)
			let txtBoxHtml=new TextBox(win0,x+txtAreaHtml.width+10,y+27,'这里显示结果').setSize(500,100);
			txtBoxHtml.html=true;
			//--win0-3--
			x=20;
			new ColorPicker(win0,x,y+=100,'背包颜色修改器','#EEEEEE',(e)=>{tabWin.setColor(e.detail)});
			//--win0-4--
			var chMaxs=['零','壹','贰','叁','肆','伍','陆','柒','捌','玖'];
			var chMins=['零','一','二','三','四','五','六','七','八','九'];
			var chOther=['拾', '佰', '仟','十','百','千']
			y+=100
			new Label(win0,x-6,y+2,'数字转成汉字');
			let chMaxText=new TextInput(win0,x+300,y,'').setSize(200,20);
			let ch2MaxText=new TextInput(win0,x+300,y+30,'').setSize(200,20);
			let ch3MaxText=new TextInput(win0,x+80,y+30,'').setSize(200,20);
			new TextInput(win0,x+80,y,'',(e)=>{
				let as=e.detail.split('');
				let ch='';
				as.forEach(a=>{ch+=chMaxs[a]||a});
				chMaxText.text=ch;
				ch2MaxText.text=numberParseChina(e.detail);
				let chs=ch2MaxText.text.split('');
				ch3MaxText.text='';
				chs.forEach(ch=>{
					if(ch!='圆'&&ch!='整'){
						let i=chMaxs.indexOf(ch);
						if(i>=0)ch3MaxText.text+=chMins[i];
						else{
							let i=chOther.indexOf(ch);
							if(i>=0)ch3MaxText.text+=chOther[i+3];
							else 	ch3MaxText.text+=ch;
						}	
					}
				})

			}).setSize(200,20);
			//--win0-5--
			y+=80;
			new Label(win0,x,y,'计算公式');
			let txtCount1=new TextInput(win0,x+60,y,'').setSize(200,20);
			let txtCount2=new TextInput(win0,x+380,y,'').setSize(100,20);
			new Button(win0,x+270,y,'计算',(e)=>{txtCount2.text=eval(txtCount1.text)});
			//--win0-6--
			y+=40;
			let saveKey='tableId'
			new Label(win0,x,y,'配置表ID不重复');
			let txtCount3=new TextInput(win0,x+100,y,'').setSize(150,20);
			let newVal=getDate('01001');
			let val=Unify.getLocalData(saveKey)||newVal
			if(val.substr(0,6)!=newVal.substr(0,6)){//月份不一样
				val=newVal;
			}
			txtCount3.text=val;
			new Button(win0,x+270,y,'复制使用',(e)=>{
				copyString(txtCount3.input);
				val=txtCount3.text;
				let n=numberFormat(Number(val.substr(6,2))+1);
				val=val.substr(0,6)+''+n+'001';
				Unify.setLocalData(saveKey,val);
				txtCount3.text=val;
			});
			function getDate(value){
				let date=new Date();
				return date.getFullYear()+''+numberFormat(date.getMonth()+1)+''+value;
			}
			//--win0-7--
			y=220;
			x=650
			new Label(win0,x,y,'7.回车符转其它符号,直接复制在左框,右框自动出结果,默认为逗号');
			let sign_7=new TextInput(win0,x+350,y-5,',').setSize(30);
			let txtAreaHtml_7=new TextArea(win0,x,y+25,'',(e)=>{
				var arr=e.target.text.split("\n");
				var str="";
				for(var i=0;i<arr.length;i++){
					str+=arr[i]+sign_7.text;
				}
				str=str.substr(0,str.length-1);
				txtBoxHtml_7.text=str;
				this.win0Label1=str;
			}).setSize(250,200)
			let txtBoxHtml_7=new TextArea(win0,x+txtAreaHtml_7.width+10,y+25,'这里显示结果').setSize(250,200);
			new Checkbox(win0,x+400,y+4,'去除重复的',false,(e)=>{
				if(e.detail){
					var arr1=this.win0Label1.split(sign_7.text);
					var arr2=Array.from(new Set(arr1));
					txtBoxHtml_7.text=arr2;
					var obj={};
					arr2.forEach(a=>{obj[a]=0});
					arr1.forEach(a=>{obj[a]+=1});
					txtShowHtml_7.text='';
					for( let i in obj){
						if(obj[i]>1){
							txtShowHtml_7.text+=i+':'+obj[i]+'\n';
						}
					}
				}else{
					txtBoxHtml_7.text=this.win0Label1;
				}
			});
			let startLabel7=new LabelInput(win0,x+500,y-24,'启始位置');
			startLabel7.input.setSize(50)
			startLabel7.input.text='1';
			new Checkbox(win0,x+500,y+4,'重复的在哪行',false,(e)=>{
				if(e.detail){
					var start=parseInt(startLabel7.input.text);
					var arr1=this.win0Label1.split(sign_7.text);
					var arr2=Array.from(new Set(arr1));
					var obj={};
					arr2.forEach(a=>{obj[a]=0});
					arr1.forEach(a=>{obj[a]+=1});
					txtShowHtml_7.text='';
					for(let i=0;i<arr1.length;i++){
						let id=arr1[i];
						if(obj[id]>1){
							txtShowHtml_7.text+=`${start+i}:${id}\n`;
						}
					}
				}
			});
			let txtShowHtml_7=new TextArea(win0,txtBoxHtml_7.x+txtBoxHtml_7.width+10,y+25,'').setSize(100,200);
			//--win0-8--
			y=400;
			x=10
			new Label(win0,x,y,'8.去除重复行');
			let label8=new Label(win0,x+100,y,'数据统计');
			let txtAreaHtml_8=new TextArea(win0,x,y+25,'',(e)=>{
				let arr1=e.target.text.split("\n");
				let arr2=Array.from(new Set(arr1));
				let [total,count]=[arr1.length,arr2.length];
				label8.text=`原来${total}行,现在是${count}行,删除重复的${total-count}行`;
				txtBoxHtml_8.text='';
				for(let i=0;i<count;i++){
					txtBoxHtml_8.text+=arr2[i]+'\n';
				}
			}).setSize(250,200)
			txtAreaHtml_8.text='内容粘贴到这里'
			let txtBoxHtml_8=new TextArea(win0,x+txtAreaHtml_7.width+10,y+25,'这里显示结果').setSize(250,200);
			//--win0-9--
			y=460;
			x=650
			new Label(win0,x,y,'9,算法公式设置');
			let input91=new TextInput(win0,x+50,y+=25,'').setSize(600);
			new Label(win0,x,y+4,'参数名');
			let input92=new TextInput(win0,x+50,y+=30,'').setSize(600);
			new Label(win0,x,y+4,'返回值');
			let input93=new TextInput(win0,x+50,y+=30,'').setSize(600);
			new Label(win0,x,y+4,'算法公式');
			let input94=new TextInput(win0,x+50,y+=30,'funName').setSize(600);
			new Label(win0,x,y+4,'方法名');
			new Button(win0,x,y+=30,'生成',()=>{
				let [as1,as2,as3]=[input91.text.split(','),input92.text.split(','),input93.text.split(',')]
				let str=`function ${input94.text} (${as1}){\n`
				str+=`  var ${as2};\n  var data;\n `;
				let data="{";
				for(var i=0;i<as3.length;i++){
					str+=`  ${as3[i]};\n`;
				}
				for(var i=0;i<as2.length;i++){
					data+=`"${as2[i]}":${as2[i]}`
					if(i<as2.length-1)data+=','
				}
				data+='};'
				str+=`  data=${data}\n  return data; \n}`;
				this.dataWindow.setContent(str);
			})
			new TextInput(win0,x+110,y,'四舍五入：Math.round()，向上取整：Math.ceil()，向下取整：Math.floor()，').setSize(500);

			//-----------我只是一条分割线---------
			//--win1-----------------------------------
			let win1=tabWin.getWindow(1);
			x=10;
			y=10;
			labels=['十进制与二进制互转','十进制与八进制互转','十进制与十六进制互转','十进制与三十二进制互转','十进制与三十六进制互转','汉字与Unicode互转(\\u+16进制)','字母数字与摩斯码互转','汉字与摩斯码互转（先将汉字转为unicode再转摩斯码）','字符串转Base64','拼音转换','中英文转换'];
			let map=new Map();
			for(let i=0;i<labels.length;i++){
				new Label(win1,x,y+=10,labels[i]);
				y+=22;
				j=(i+1)*100;
				map.set((++j),new TextInput(win1,x,y,'',(e)=>{
					let input=e.target;
					let type=Number(input.id)
					let cbox=map.get(type+1);
					let output=map.get(type+2);
					if(!cbox.checked){
						switch(Number(type)){
							case 101: output.text=Number(input.text).toString(2);break;
							case 201: output.text=Number(input.text).toString(8);break;
							case 301: output.text=Number(input.text).toString(16);break;
							case 401: output.text=Number(input.text).toString(32);break;
							case 501: output.text=Number(input.text).toString(36);break;//目前最多能转的上限（26个字母加0-9个数字等于36）
							case 601: output.text=Unify.toUnicode(input.text);break;
							case 701: output.text=Unify.mosi(input.text,0);break;
							case 801: output.text=Unify.mosiUnicode(Unify.toUnicode(input.text),0);break;
							case 901: output.text=Unify.base64(input.text,0);break;
							case 1001: output.text=Unify.changePinyin(input.text,0);break;
							case 1101: Unify.chToEn(input.text,(val)=>{output.text=val});break;
						}
					}
					
				}).setSize(300).setId(j));
				map.set((++j),new Checkbox(win1,x+300+4,y+4,'反转').setId(j));
				map.set((++j),new TextInput(win1,x+350,y,'',(e)=>{
					let input=e.target;
					let type=Number(input.id)-2
					let cbox=map.get(type+1);
					let output=map.get(type);
					console.log(type,cbox.checked)
					if(cbox.checked){
						switch(Number(type)){
							case 101: output.text=parseInt(input.text,2);break;
							case 201: output.text=parseInt(input.text,8);break;
							case 301: output.text=parseInt(input.text,16);break;
							case 401: output.text=parseInt(input.text,32);break;
							case 501: output.text=parseInt(input.text,36);break;
							case 601: output.text=Unify.toChineseWords(input.text);break;
							case 701: output.text=Unify.mosi(input.text,1);break;
							case 801: output.text=Unify.mosiUnicode(Unify.mosi(input.text,1),1);break;
							case 901: output.text=Unify.base64(input.text,1);break;
							case 1001: output.text=Unify.changePinyin(input.text,1);break;
							case 1101: Unify.chToEn(input.text,(val)=>{output.text=val});break;
						}
					}
					
				}).setSize(300).setId(j));
				y+=22;
			}
			new Button(win1,x,y+=25,'摩斯码练习',()=>{window.open('MorseCode.html','_blank');})
			new Button(win1,x+=110,y,'在线文本对比',()=>{window.open('https://www.qianbo.com.cn/Tool/Text-Difference/','_blank');})
			new Button(win1,x+=110,y,'apiDemo',()=>{window.open('../demo/apiDemo.html','_blank');})
			//console.log(map);
			//--win2--------------------------------------
			let win2=tabWin.getWindow(2);
			x=10;
			y=20;
			let [w,h]=[win2.width/2,win2.height-y];
			let txtInput=new MoonTextArea(win2,0,y).setSize(w,h);
			let txtOut=new MoonTextArea(win2,w,y).setSize(w,h);
			new Label(win2,60,5,"trace('数据输出')")
			new Button(win2,0,0,'运行',(e)=>{
				eval(txtInput.text);
			}).setSize(50);
			new Button(win2,w,0,'清空',(e)=>{
				txtOut.text='';
			}).setSize(50);
			function trace(...arg){
				arg.forEach((a)=>{
					txtOut.text+=a+'\n';
				})
			}
			//--win3------------------------------------
			let win3=tabWin.getWindow(3);
			x=10;
			y=20;
			[w,h]=[win3.width/2,win3.height-y];
			let txtInput3=new MoonTextArea(win3,0,y).setSize(w,h);
			let txtOut3=new MoonTextArea(win3,w,y).setSize(w,h);
			new Button(win3,0,0,'转换',(e)=>{
				txtOut3.text='';
				let content=txtInput3.text;
				let [spacing,j,i,tf]=[0,0,0,''];
				for(i=0;i<content.length;i++){
					let s=content.substr(i,1);
					if(s=="}"){
						tf+=("\n");
						spacing-=2;
						for(j=0;j<spacing;j++){
							tf+=(" ");
						}
					}
					tf+=(s);
					if(s==","){
						tf+=("\n");
						for(j=0;j<spacing;j++){
							tf+=(" ");
						}
					}
					if(s=="{"){
						tf+=("\n");
						spacing+=2;
						for(j=0;j<spacing;j++){
							tf+=(" ");
						}
					}
				}
				txtOut3.text=tf;
			}).setSize(50);
			new Button(win3,w,0,'清空',(e)=>{
				txtOut3.text='';
			}).setSize(50);
			//--win4------------------------------------
			let win4=tabWin.getWindow(4);
			x=10;
			y=20;
			[w,h]=[win4.width/2,win4.height-y];
			let txtInput4=new MoonTextArea(win4,0,y).setSize(w,h);
			let txtOut4=new MoonTextArea(win4,w,y).setSize(w,h);
			new Button(win4,0,0,'转换为数组',(e)=>{
				let content=txtInput4.text;
				let arr=content.split('\n');
				txtOut4.text='[\n';
				arr.map(a=>{
					var as=a.split('\t');
					if(as.length>1){
						as=as.map(b=>{if(isNaN(b)) return'"'+b+'"';else return b;});
						txtOut4.text+=`[${as}],\n`;
					}
				});
				txtOut4.text+=']';
			}).setSize(80);
			new Button(win4,80,0,'转换为对象',(e)=>{
				let content=txtInput4.text;
				let arr=content.split('\n');
				let first=arr[0].split('\t');
				let len=arr.length;
				let len2=first.length;
				txtOut4.text='[\n'
				for(let i=1;i<len;i++){
					let a=arr[i];
					let as=a.split('\t');
					if(as.length>1){
						txtOut4.text+='{';
						for(let j=0;j<len2;j++){
							let b=as[j];
							txtOut4.text+='"'+first[j]+'":'+(isNaN(b)?'"'+b+'"':b)+(j<len2-1?",":"");
						}
						txtOut4.text+='},\n';
					}
				};
				txtOut4.text+=']';
			}).setSize(80);
			new Button(win4,160,0,'在线表格',(e)=>{
				let url='https://demo.grapecity.com.cn/SpreadJS/WebDesigner/';
				window.open(url,'_blank');
			})
			new Button(win4,w,0,'复制',(e)=>{
				copyString(txtOut4.input)
			}).setSize(50);
			new Button(win4,w+50,0,'清空',(e)=>{
				txtOut4.text='';
			}).setSize(50);
			//--win5------------------------------------
			let win5=tabWin.getWindow(5);
			[w,h,y]=[win5.width/2,win5.height-2,30];
			var [startTime,currTime,isTime]=[0,0,false];
			var st='00:00:00.000';
			var panel1 = new Panel(win5, 0, 0, w,h);
			var panel2 = new Panel(win5, w, -h, w,h);
			new Label(panel1,5,5,'计时器').setColor('#ff0000').setFontSize(15);
			new Label(panel2,5,5,'倒计时').setColor('#ff0000').setFontSize(15);
			('-------------计时器---------------')
			let txtInput5=new TextInput(panel1,100,y-20,st);
			let txtOut5=new MoonTextArea(panel1,100,y).setSize(w-110,h-2*y);
			let countTimeClear=0;
			new Button(panel1,10,y,'开始计时',(e)=>{
				setTime();
				isTime=true;
				update();
			}).setSize(80);
			new Button(panel1,10,y+=22,'记录计时',(e)=>{
				txtOut5.text+=getTimeFormat(currTime)+'\n'
			}).setSize(80);
			new Button(panel1,10,y+=22,'暂停计时',(e)=>{
				isTime=false;
			}).setSize(80);
			new Button(panel1,10,y+=22,'继续计时',(e)=>{
				isTime=true;
				update();
			}).setSize(80);
			new Button(panel1,10,y+=22,'重置',(e)=>{
				isTime=false;
				txtInput5.text=st;
				txtOut5.text='';
			}).setSize(80);
			function setTime(){
				isTime=false;
				startTime=(new Date()).getTime();
				currTime=startTime;
				txtInput5.text=st;
				txtOut5.text='';
			}
			function update(){
				if(isTime){
					currTime=(new Date()).getTime()-startTime;
					txtInput5.text=getTimeFormat(currTime);
					clearTimeout(countTimeClear);
					countTimeClear=setTimeout(update,30);
				}
			}
			function getTimeFormat(num){
				num/=1000;//毫秒转为秒
				var hours=parseInt((num)/3600);
				var minute=parseInt((num-(hours*3600))/60);
				var second=parseInt((num-(hours*3600)-(minute*60)));
				var minSec=(String(num).split('.')[1])||'0';
				var len=minSec.length;
				minSec=len==1?minSec+'00':len==2?minSec+'0':minSec;
				return `${numberFormat(hours)}:${numberFormat(minute)}:${numberFormat(second)}.${minSec}`;
			}
			('-------------倒计时---------------')
			var timeBtns=['1分钟','3分钟','5分钟','10分钟','30分钟','60分钟'];
			var [downTimeStart,downTimeCurr,downTimeClear,downTimeTotal]=[0,0,0,0];
			y=10;
			for(i=0;i<timeBtns.length;i++){
				new Button(panel2,10,y+=22,timeBtns[i],(e)=>{
					setDownStartTime(e.target.label.split('分钟')[0]);
				}).setSize(80);
			}
			var isShowAlert=true;
			new Checkbox(panel2,x,250,'不显示结束提示',false,(e)=>{isShowAlert=!e.detail});
			var downTimePro=new ProgressBar(panel2,220,30,100).setSize(100,20);
			var downTimeText=new TextInput(panel2,110,30,st);
			var downTimeLabel=new LabelInput(panel2,10,y+=22,'单位分钟').setInputSize(40);
			downTimeLabel.input.text='45';
			new Button(panel2,110,y,'开始',(e)=>{
				setDownStartTime(downTimeLabel.input.text);
			}).setSize(40);
			new Button(panel2,10,y+=22,'重置',(e)=>{
				downTimeStart=0;
				downTimeText.text=st;
				downTimePro.progress=downTimePro.max;
			}).setSize(80);
			function setDownStartTime(time){
				downTimeTotal=Number(time)*60000;
				downTimeStart=(new Date()).getTime();
				downTimePro.max=downTimeTotal;
				downTimePro.progress=downTimePro.max;
				downTimeUpdate();
			}
			function downTimeUpdate(){
				if(downTimeStart>0){
					downTimeCurr=(new Date()).getTime()-downTimeStart;
					let time=downTimeTotal-downTimeCurr;
					downTimeText.text=getTimeFormat(time);
					downTimePro.progress=time;
					clearTimeout(downTimeClear);
					downTimeClear=setTimeout(downTimeUpdate,30);
					if(time<=0){
						downTimeStart=0;
						downTimeText.text=st;
						isShowAlert&&TipsManager.SureAlert('时间到了');
						soundEffct_1.play();
					} 
				}
			}
			'-------控制声音----------'
			//--win6------------------------------------
			let win6=tabWin.getWindow(6);
			win6.addChild(soundControl);
			var [soundFiles,soundIndex,soundIsMore]=[[],0,0];
			var files;
			var currbase64;
			soundControl.ondragover = function (e) {
				e.preventDefault();
			}
			soundControl.ondrop = function (e) {
				//console.log(e.dataTransfer.files);
				e.preventDefault();
				files=e.dataTransfer.files;
				soundFiles=files;
				soundIndex=0;
				for(var i=0;i<files.length;i++){
					var file=files[i];
					var btn=document.createElement('input');
					btn.addEventListener('click',onClickSound);
					btn.type='button';
					//btn.style='background-color: #4CAF50;border: none;color: white;';
					btn.file=file;
					btn.value=file.name.split('.')[0]
					btnDiv.appendChild(btn);
				}
				//console.log(btnDiv.children)
			}
			function onClickSound(e){
				//console.log(e.target.file);
				var file = e.target.file;  
				playSound(file);
			}
			function playSound(file){
				var reader = new FileReader();  
				reader.onload = function() {  
					audio.src=this.result;
					currbase64=this.result;
					//console.log('base64位='+currbase64);
					//console.log(audio.duration)
					setTimeout(()=>{txtTime.text=`时长秒数：${audio.duration}`;txtSize.text=`字节点数：${Math.round(getBase64Size(currbase64)/1024)}KB`},500);
				}
				reader.readAsDataURL(file);
				txtSound.text='现在播放的是：'+file.name;
			}
			/**返回字节*/
			function getBase64Size(base64){
				if (base64) { 
					base64=base64.split(",")[1].split("=")[0];
					let strLength = base64.length;
					let fileLength = strLength - (strLength / 8) * 2;
					return Math.floor(fileLength); 
				} else {
					return null
				}
			}
			audio.onended=()=>{
				if(soundIsMore){
					if(soundIndex<soundFiles.length-1){
						soundIndex++;
					}else{
						soundIndex=0;
					}
					playSound(soundFiles[soundIndex]);
				}
			}
			[x,y]=[620,10]
			new Button(win6,x,y,'清空',(e)=>{
				while(btnDiv.children.length>0){
					btnDiv.removeChild(btnDiv.children[0]);
				}
			}).setSize(80);
			var txtSound=new Label(win6,x,y+=22,'你想播放点啥');
			var txtTime=new Label(win6,x,y+=22,'声音时长');
			var txtSize=new Label(win6,x,y+=22,'声音字节');
			new Toggle(win6, x+10, y+50, '是否单个循环',false,(e)=>{
				audio.loop=e.detail;
				soundIsMore=0;
			});
			new Toggle(win6, x+10, y+100, '是否所有循环',false,(e)=>{
				soundIsMore=e.detail;
				audio.loop=0;
			});
			var txtUrl=new LabelInput(win6, x+10, y+150,'拼音加数字音标');
			txtUrl.input.setSize(50)
			txtUrl.input.text='yin3';
			new Button(win6,x+10,y+180,'确定',(e)=>{
				let py=txtUrl.input.text;
				py=Unify.changePinyin(py,1);
				let url='https://ywx620.gitee.io/learn/rec/sound/hanzi/'+py+'.mp3';
				audio.src=url;
			})
			new Button(win6,x+10,y+210,'复制base64',(e)=>{
				if(currbase64){
					Unify.copyString(currbase64);
				}else{
					TipsManager.alert('base64为空，请拖入声音点播发后再试');
				}
			})
			let txtSoundTime=null;
			let lyricsIndex=0;
			let lyricsDatas=[];
			new Button(win6,x+10,y+260,'修改歌词',(e)=>{
				let datas=lyrics.text.split('\n');
				let value='';
				lyricsDatas.length=0;
				lyricsIndex=0;
				datas.forEach((v,i)=>{
					let val=` { time: , text: "${v}" },\n`;
					value+=val;
					lyricsDatas.push(val);
				})
				txtSoundTime=new TextInput(win6,lyrics.x-45,10).setSize(40);
				lyrics.text=value;
			})
			new Button(win6,x+10,y+290,'加入时间',(e)=>{
				if(txtSoundTime){
					if(lyricsIndex<lyricsDatas.length){
						let v=lyricsDatas[lyricsIndex];
						let as=v.split('{ time: ');
						lyricsDatas[lyricsIndex]='{ time: '+txtSoundTime.text+as[1];
						let value='';
						lyricsDatas.forEach(v=>{
							value+=v;
						})
						lyrics.text=value;
						lyricsIndex++;
					}
				}
			})
			let lyrics=new MoonTextArea(win6,x+220,10).setSize(w-190,h-y);
			audio.addEventListener('timeupdate', function() {
            	let currentTime = Math.floor(audio.currentTime);
				if(txtSoundTime)txtSoundTime.text=currentTime;
				
			});
			'-------控制视频----------'
			//--win7------------------------------------
			let win7=tabWin.getWindow(7);
			win7.addChild(videoControl);
			videoControl.ondragover = function (e) {
				e.preventDefault();
			}
			videoControl.ondrop = function (e) {
				console.log(e.dataTransfer.files);
				e.preventDefault();
				files=e.dataTransfer.files;
				for(var i=0;i<files.length;i++){
					var file=files[i];
					var btn=document.createElement('input');
					btn.addEventListener('click',onClickVideo);
					btn.type='button';
					//btn.style='background-color: #4CAF50;border: none;color: white;';
					btn.file=file;
					btn.value=file.name.split('.')[0];
					btnDiv2.appendChild(btn);
				}
				//console.log(btnDiv.children)
			}
			function onClickVideo(e){
				//console.log(e.target.file);
				var file = e.target.file;  
				var reader = new FileReader();  
				reader.onload = function() {  
					video.src=this.result;
				}
				reader.readAsDataURL(file);
				txtVideo.text='现在播放的是：'+file.name;
				TipsManager.alert('视频加载中');
			}
			[x,y]=[620,10];
			new Button(win7,x,y,'清空',(e)=>{
				while(btnDiv2.children.length>0){
					btnDiv2.removeChild(btnDiv2.children[0]);
				}
			}).setSize(80);
			var txtVideo=new Label(win7,x,y+=22,'你想播放点啥');

			'-------数据转换----------'
			//--win8------------------------------------
			let win8=tabWin.getWindow(8);
			new Label(win8,10,520,'z4 xml to as, z5 json to as.');
			let isChangeData=new Checkbox(win8,10,550,'是否提取id-name',false);
			win8.addChild(dragDiv);
			dragDiv.ondragover = function (e) {
				e.preventDefault();
			}
			dragDiv.ondrop = function (e) {
				e.preventDefault();
				files=e.dataTransfer.files;
				//console.log(files);
				for(var i=0;i<files.length;i++){
					dataToData(files[i]);
				}
			}
			function dataToData(file){
				var reader = new FileReader();  
				reader.onload = function() {
					let result=this.result;
					let names=this.file.name.split('.');
					let [name,type]=names;
					//console.log(this.file.name,name);
					var str="package models.vo.module";
					if(type==='xml'){//ZM4
						var parser=new DOMParser();
						var xmlDoc=parser.parseFromString(result,"text/xml");
						var xmllist=xmlDoc.getElementsByTagName('RECORD');
						var first=xmllist[0];
						str+="\n{\n\timport com.game.utils.VoBasic;\n\tpublic class "+name+"Vo extends VoBasic\n\t{\n"
						for(var j=0;j<first.children.length;j++){
							var node=first.children[j];
							str+="\t\t/***/\n";
							str+="\t\tpublic var "+node.nodeName+":Number;\n";
						}
						if(isChangeData.checked){//输出数据中所有id和name
							str='';
							for(var j=0;j<xmllist.length;j++){
								var first=xmllist[j];
								for(var k=0;k<first.children.length;k++){
									var node=first.children[k];
									if(node.nodeName=='id'){
										str+=node.textContent+'-';
									}
									if(node.nodeName=='name'){
										str+=node.textContent+'\n';
									}
								}
							}
						}
					}else if(type==='json'){//ZM5
						str+="\n{\n\timport com.wdcgame.utils.VoBasic;\n\tpublic class "+name+"Vo extends VoBasic\n\t{\n"
						var json=JSON.parse(result);
						var jsonChild=json["1"];
						for(var k in json){
							jsonChild=json[k];
							break;
						}
						for(k in jsonChild){
							str+="\t\t/***/\n"
							str+="\t\tpublic var "+k+":Number;\n";
						}
						if(isChangeData.checked){//输出数据中所有id和name
							str='';
							for(var j in json){
								jsonChild=json[j];
								for(k in jsonChild){
									if(k=='id'){
										str+=jsonChild[k]+'-';
									}
									if(k=='name'){
										str+=jsonChild[k]+'\n';
									}
								}
							}
						}
					}else{
						TipsManager.SureAlert('只能拖入xml或json文件')
						return;
					}
					str+="\t}\n}";
					console.log(str);
					download(name+'Vo.as',str);
				}
				reader.file=file;
				reader.readAsText(file);
			}
			'-------重命名----------'
			//--win9------------------------------------
			var dragDiv9=dragDiv.cloneNode(true);
			let win9=tabWin.getWindow(9);
			win9.addChild(dragDiv9);
			new Label(win9,10,520,'把要重命名的文件拖入到此处，然后对应的名字修改好后，把内容复制下来。在文件同目录下新建一个.txt文件将它打开编辑粘贴刚才的内容，修改编码为ANSI，然后另存为rename.bat。最后双击运行remain.bat');
			let nameLabel9=new LabelInput(win9,10,550,'想要的名字');
			nameLabel9.input.text='newName'
			dragDiv9.ondragover =  (e)=> {
				e.preventDefault();
			}
			dragDiv9.ondrop =  (e)=> {
				e.preventDefault();
				files=e.dataTransfer.files;
				let str='@echo off\n';
				for(var i=0;i<files.length;i++){
					var file=files[i];
					var name=file.name;
					let newName=nameLabel9.input.text?nameLabel9.input.text+Number(i+1)+'.'+name.split('.')[1]:name;
					str+=`ren "${name}" "${newName}"\r\n`;
					//console.log(file.name);
				}
				this.dataWindow.setContent(str);
				// 因无法保存文本编码为ANSI和Window CR LR所以还是手动新建.txt再修改.bat
				// this.dataWindow.btnClose.addEventListener("click", ()=>{
				// 	str=this.dataText.text;
				// 	var file = new File([str], "rename.bat", { type: "text/plain;charset=utf-8" });
				// 	saveAs(file);
				// });
			}
			// var xmlhttp=new XMLHttpRequest();
			// xmlhttp.onreadystatechange=function()
			// {
			// 	//if (xmlhttp.readyState==4 && xmlhttp.status==200)
			// 	//{
			// 		console.log(xmlhttp.responseText);
			// 	//}
			// }
			// xmlhttp.open("get","http://pv.sohu.com/cityjson?ie=utf-8",true);//安全域的问题无法请求数据
			// xmlhttp.send();
			'-------制作JSON数据----------'
			//--win10------------------------------------
			let win10=tabWin.getWindow(10);
			let nodes=[];
			let [x10,y10,gap10]=[160,10,30];
			new Button(win10,20,35,'增加节点',(e)=>{
				createNode();
			})
			new Button(win10,20,60,'删除节点',(e)=>{
				if(nodes.length>1){
					removeNode();
				}else{
					TipsManager.alert('不可再删除')
				}
			})
			new Button(win10,20,110,'复杂数据',(e)=>{window.open('https://www.bejson.com/jsoneditoronline/','_blank');});
			new Button(win10,20,85,'生成数据',(e)=>{
				let str='';
				str+=`{`
				let i=0;	
				nodes.forEach(ns=>{
					let key=ns[0].text;
					let value=ns[1].text;
					//console.log(key,value)
					i++;
					if(!!key){
						str+=`"${key}":`;
						if(!isNaN(Number(value))){//数值
							str+=`${Number(value)},`;
						}else if(value.substr(0,1)=='{'){//对象
							try{
								JSON.parse(value);
								str+=`${value},`
							}catch(e){
								TipsManager.alert('第'+i+'行的数据结构有错',3000);
								i=-999;
							}
						}else if(value.includes(',')&&Array.isArray(value.split(','))){//数组
							if(value.includes('str:')){//带有','又不转为数组可在开头增加str:
								str+=`"${value.split('str:')[1]}",`
							}else{
								let arr=value.split(',');
								arr=arr.map(a=>{
									if(isNaN(Number(a))) a=`"${a}"`;
									return a;
								})
								str+=`[${arr.toString()}],`;
							}

						}else{//字符串
							str+=`"${value}",`
						}
						//str+=(isNaN(Number(value))?`"${value}",`:`${Number(value)},`);
					}
				})
				if(i<0)return;
				str=str.substr(0,str.length-1)
				str+='}';
				console.log(str);
				this.dataWindow.setContent(str);
			})
			
			function createNode(key='',val=''){
				y10+=gap10;
				let y=y10;
				// let btn=new Button(win10,x10+210,y,'+',addChildNode);
				// btn.setSize(20,20);btn.index=nodes.length;
				nodes.push([new TextInput(win10,x10,y,key),new TextInput(win10,x10+110,y,val).setSize(900),new Label(win10,x10-20,y+4,nodes.length+1)]);
			}
			function removeNode(){
				let ns=nodes.pop();
				ns.forEach(n=>n.removeFromParent(true));
				y10-=gap10;
			}
			function addChildNode(e){
				console.log(e.target.index);
			}
			createNode();
			new Label(win10,10,10,'第一个框输入key，第二个框输入value，value可以支持数字、字符串、对象、数组，数字数组1,2,3  字符串数组a,b,c  对象{"a":1,"b":"hello"}，带有,(英语逗号)又不转为数组可在开头增加str:');

			new Label(win10,5,160,'数据拷贝到此可转换');
			let input10=new TextInput(win10,5,180,'',(e)=>{
				let value=e.detail;
				try{
					value=JSON.parse(value);
					while(nodes.length>0){
						removeNode();
					}
					for(let key in value){
						let val=value[key];
						if(typeof val ==='string'){
							if(val.includes(',')){//字符串有英语逗号的在请面加str:表示字符串不转为数组
								val='str:'+val;
							}
							createNode(key,val);
						}else{
							if(!Array.isArray(val)){//不是数组
								try{val=JSON.stringify(val);}catch(e){}//如果是对象则转为字符串
							}
							createNode(key,val.toString());
						}
					}
					TipsManager.alert('数据转换成功');
				}catch(e){
					TipsManager.alert('数据结构有错');
				}
				input10.text='';
			}).setSize(120,22)
			'-------制作二维码----------'
			//--win11------------------------------------
			let win11=tabWin.getWindow(11);
			[x,y,w]=[10,10,250];
			let input11=new TextInput(win11,x,y,'',(e)=>{
				let value=(e.detail);
				qrcode.clear();
				qrcode.makeCode(value);
			});
			input11.setSize(400);
			let panel11=new Panel(win11,x,y+30);
			panel11.setSize(w+20,w+20);
			panel11.addChild(orcode);
			var qrcode = new QRCode(orcode,{width:w,height:w});
			'-------其它工具----------'
			//--win12------------------------------------
			let win12=tabWin.getWindow(12);
			[x,y,w]=[10,10,250];
			var data12=[
				["看图小工具","./lookImage.html"],
				["看系统字体","./lookFont.html"],
				["正则表达式","./RegExp.html"],
				["可生成拼音","./createPY.html"],
				["毫秒倒计时","./millisecond.html"],
				["JS帮忙表格","./JSHelp.html"],
				["摩斯码练习","./MorseCode.html"],
				["开根号工具","./mathSqrt.html"],
				["FLASH模拟器","./FlashDemo.html"],
				["BOX2D展示","./moonBox2d-joint.html"],
				["在线写HTML","./onlineWriteHtml.html"],
				["在线写游戏","./onlineWriteJs.html"],
				["汽车华容道","./carHRD.html"],
				["俄罗斯方块","./tetris2.html"],
				["让代码高亮","./codeHighLight.html"],
				["贪吃蛇","./snake.html"],
				["短网址生成器","https://gsz.qituowl.cn/freeResult/11047"],
				["代码复制分享","https://highlightjs.org/demo#lang=javascript&v=1&theme=srcery"],
				["去重复行","https://www.iamwawa.cn/quchong.html"],
				["编辑声音","https://vocalremover.org/zh/cutter"],
				["编辑图片","https://www.photopea.com/"],
				["压缩JS","https://www.toptal.com/developers/javascript-minifier"],
			]
			for(let i=0;i<data12.length;i++){
				let data=data12[i];
				new Button(win12,x+6,y+=22,data[0],(e)=>{window.open(data[1],'_blank');});
			}
		}
	}
	//-----------------写代码工具面板-----------------
	class WriteJsToolPanel extends BasicPanel{
		constructor(label){
			super(label);
			let [x,y,n,p]=[5,20,10,5];
			let [w,h]=[this.p.width/n,this.p.height-y];
			this.txtInput=new MoonTextArea(this.p,0,y).setSize(w*p,h);
			this.txtInput.fontSize = 15;
			let canvas=new Canvas(this.p,w*p,y).setSize(w*(n-p),h);
			this.moonjs=null;
			this.mb=null;
			this.canvas=canvas;
			this.name='WriteJsToolPanel';
			let data=Unify.getLocalData(this.name);
			if(data){
				this.txtInput.text=data;
			}
			
			new Button(this.p,x,0,'运行',(e)=>{
				this.clear();
				let data=this.txtInput.text;
				Unify.setLocalData(this.name,data);
				eval(data);
			}).setSize(50);
x+=50;
new Button(this.p,x,0,'创建物理引擎',(e)=>{
this.txtInput.text=`if(!this.mb){
   this.mb=new MoonBox2d();
   this.mb.box2dInit(canvas,1);
   this.mb.openMouseEvent();
}
let mb=this.mb;
mb.reInit();
var body=mb.createCircle(180,100,13);

`
});
x+=100;
new Button(this.p,x,0,'创建块状引擎',(e)=>{
this.txtInput.text=`if(!this.moonjs){
   this.moonjs=new MoonBit101();
   this.moonjs.init(canvas);
   this.moonjs.setGapXY(this.p.x,this.p.y);//设置xy轴上的偏移量
}
let moonjs=this.moonjs;
moonjs.start();
var rect=moonjs.createDisplay('rect').setXY(200,0);
moonjs.update=()=>{
   //写你想让块状动起来的代码
   rect.y++;
}
`
});
x+=100;
new Button(this.p,x,0,'创建createjs引擎',(e)=>{
this.txtInput.text=`if(!this.cJsStage){
   this.cJsStage = new createjs.Stage(canvas);
}
let createJs=this.cJsStage;
let circle = new createjs.Shape();
circle.graphics.beginFill("red").drawCircle(200, 0, 20);
createJs.addChild(circle);
createJs.update();
createjs.Ticker.addEventListener("tick",(e)=>{
   circle.y++;
   createJs.update();
});
`
});
			new Button(this.p,this.p.width-65,0,'清理数据',this.clear.bind(this)).setSize(60);
			new Button(this.p,this.p.width-140,0,'保存代码',this.onSave.bind(this)).setSize(60);
			new Button(this.p,this.p.width-200,0,'帮助',this.openHelp.bind(this)).setSize(60);
			new Button(this.p,this.p.width-300,0,'独立写代码',(e)=>{window.open('./onlineWriteJs.html','_blank');}).setSize(80);
			new Button(this.p,this.p.width-380,0,'哥在写代码',(e)=>{window.open('../onlineCode/index.html','_blank');}).setSize(80);

			x+=100;
			new Dropdown(this.p,x,0,['黑白棋','躲避子弹','落下的弹珠'],0,this.selectDemo.bind(this));

			function trace(...arg){
				arg.forEach((a)=>{
					console.log(a);
				})
			}
		}
		selectDemo(e){
			this.txtInput.text=jsToolGameDemo[e.detail.index];
		}
		openHelp(){
			helper.writeJsToolPanel();
		}
		setData(data){
			if(this.isShow)	this.txtInput.text=data;
		}
		onSave(){
			var content=this.txtInput.text;
			var file = new File([content], "yourCode.js", { type: "text/plain;charset=utf-8" });
			saveAs(file);
		}
		clear(){
			if(this.moonjs){
				this.moonjs.stop();
				this.moonjs.map.clear();
			}
			if(this.mb){
				this.mb.stop();
				this.mb.destroyAll();
			}
			if(this.cJsStage){
				this.cJsStage.clear();
				this.cJsStage.removeAllChildren();
				createjs.Ticker.removeAllEventListeners("tick");
			}
			this.canvas.getContext("2d").clearRect(0, 0, this.canvas.width, this.canvas.height);
			this.canvas.color='#FFFFFF';
		}
	}
	
	//-----------------颜色选择数据-----------------
	class CheckDataPanel extends BasicPanel{
		constructor(label){
			super(label);
			this.setDataWindow();
			let x=280;
			let y=72;
			let w=width*0.65;
			let h=height-100;
			let str="";
			this.txtInput=new LabelInput(this.p,x,y,'rgb的值');
			this.txtInput.setInputSize(150).input.x=50;

			x+=220;
			this.currNode=null;
			for(let i=0;i<2;i++){
				let canvas=new Canvas(this.p,x,y);
				let label=new Label(canvas,35,40,'内容文字'+i).setFontSize(30);
				canvas.addEventListener("click", (e)=>{this.currNode=e.target});
				label.addEventListener("click", (e)=>{this.currNode=e.target});
				this.currNode=canvas;
				x+=220;
			}
			
			[x,y]=[600,220];
			new Label(this.p,x,y,'输入HTML格式得到结果');
			let txtAreaHtml=new TextArea(this.p,x,y+25,"<font color='#ff0000'>标题</font></br><font color='#0000ff'>内容</font>",(e)=>{
				txtBoxHtml.text=e.target.text;
			}).setSize(400,400)
			let txtBoxHtml=new TextBox(this.p,x+txtAreaHtml.width+10,y+27,'这里显示结果').setSize(400,400);
			txtBoxHtml.setFontSize(20);
			txtBoxHtml.bold=true;
			txtBoxHtml.html=true;

			[x,y]=[20,220];
			let y10=220;
			let nodes=[];
			let p=this.p;
			new Button(p,x,y+=25,'增加节点',(e)=>{
				createNode();
			})
			new Button(p,x,y+=25,'删除节点',(e)=>{
				if(nodes.length>1){
					removeNode();
				}else{
					TipsManager.alert('不可再删除')
				}
			})
			new Button(p,x,y+=25,'生成数据',(e)=>{
				let str='';
				let i=0;	
				nodes.forEach(ns=>{
					let color=ns[0].text;
					let value=ns[1].text;
					if(color!=''&&value!=''){
						let br=ns[2].checked?'</br>':'';
						if(color.indexOf('#')==-1) color='#'+color;
						str+=`<font color='${color}'>${value}</font>${br}`
						this.dataWindow.setContent(str);
					}
				})	
			})
			
			function createNode(key='',val=''){
				let x=150
				y10+=25;
				nodes.push([new TextInput(p,x,y10,key),new TextInput(p,x+110,y10,val).setSize(200),new Checkbox(p,x+320,y10+4,'换行')]);
			}
			function removeNode(){
				let ns=nodes.pop();
				ns.forEach(n=>n.removeFromParent(true));
				y10-=25;
			}
			function addChildNode(e){
				console.log(e.target.index);
			}
			createNode('FF0000','内容');
		}
		initData(){
			this.p.addChild(colorDiv);
		}
		updateColor(t){
			this.txtInput.input.text=t.toRGBString();
			this.currNode.setColor(t.toString())
		}
	}
	//-----------------画形状用-----------------
	class DrawShapePanel extends BasicPanel{
		constructor(label){
			super(label);
			let x=5;
			let y=5;
			this.alpha=0.3;
			this.color='#00ff00';
			this.shapeId=0;
			this.isStart=false;
			this.isBox2d=false;
			this.status=0;
			var moonjs=new MoonBit101();
			this.moonjs=moonjs;
			this.inputs=[];
			this.txtTip=new Label(this.p,200,-15);
			this.image=null;
			let webs=[];
			let [cx,cy]=[400,100];//初始锚点位置
			moonjs.dragDownCb=(t)=>{
				for(let o of moonjs.map.values()){
					if(o.alpha==this.alpha)	o.childs[0].setColor('#000');
				}
				t.childs[0].setColor('#ff0000');
			}
			
			new Button(this.p,x,y,'创建',(e)=>{
				moonjs.init(this.p);
				moonjs.start();
				if(this.inputs){
					this.inputs.forEach((o)=>o.visible=false);
					this.inputs.length=0;
				}
				webs=moonjs.createWeb({w:this.p.width,h:this.p.height,xNum:30,yNum:30,color:'#999999',x:200,s:0.1});
				let rects=[[-50,-50],[50,-50],[50,50],[-50,50]];
				let circel=moonjs.createDisplay('circle').setXY(cx,cy);
				circel.r=5;//设置锚点圆半径与z轴
				circel.z=99999999;
				this.centerPos=circel;
				for(let i=0;i<4;i++){
					let pos=rects[i];
					let [x,y]=[cx+pos[0],cy+pos[1]];
					let o=moonjs.createDisplay('circle').setXY(x,y).setAlpha(this.alpha).setRadius(8);
					o.addChild(moonjs.createDisplay('circle').setRadius(1.5));
					this.addInput(o.id);
				}
				
				moonjs.startDrag(this.dragUpdate.bind(this));
				this.createShape();
			}).setSize(80);
			/**
			new Toggle(this.p,x+100,y+15,'是否拖动',!this.status,(e)=>{
				this.status=!this.status;
				this.txtTip.text=this.status?'点击屏幕可以增加一个点（此模式下也可以拖动，需注意没碰到红点就变成增加红点）':'点击红点可以拖动（此模式下不能在屏幕上加点，可放心拖动）'
			})
			*/
			let g=++group;
			let arr=['增加与拖动','只能拖动','只能删除'];
			for(var i=0;i<3;i++){
				new RadioButton(this.p, x+105, y+i*18, g, arr[i], i==0, (e)=>{
					if(e.detail===arr[0])		this.status=0;
					else if(e.detail===arr[1])	this.status=1;
					else if(e.detail===arr[2])	this.status=2;
					moonjs.setPauseDrag(this.status==2);
				});
			}
			let w=width-110;
			let h=120;
			this.txtOut=new TextArea(this.p,0,this.p.height-h,'').setSize(w,h);

			moonjs.dragMoveCb=this.dragUpdate.bind(this);

			new ColorPicker(this.p,x,y+40, '颜色修改器',this.color,(e)=>{this.color=e.detail});
			
			new Button(this.p,x,y+500,'转box2d',(e)=>{
				this.isBox2d=true;
				this.createShape();
			}).setSize(60)
			
			new Button(this.p,x+65,y+500,'转画布图',(e)=>{
				this.isBox2d=false;
				this.createShape();
			}).setSize(60)
			
			let btn=new Button(this.p,x+130,y+500,'同步画布').setSize(60);
			btn.addEventListener("mousedown",(e)=>{
				this.inputs.forEach((a)=>{
					let o=moonjs.map.get(parseInt(a.id));
					let pos=a.txtInput.text.split(',');
					console.log(o,pos);
					o.setXY(pos[0],pos[1]);
				})
				this.createShape();
			},false);//防止多次被调用
			
			Toggle.labelPosition='left'
			new Toggle(this.p,x+100,y+530,'是否显示网格',true,(e)=>{
				webs.forEach((a)=>{
					a.alpha=!a.alpha;
				})
			})

			this.p.addEventListener("click",(e)=>{
				let [x,y]=[e.clientX-this.p.offsetLeft,e.clientY-this.p.offsetTop];
				console.log(x,y);
				if(x<200||y>550)return;
				if(moonjs.map&&moonjs.map.size>0){
					let o=moonjs.checkHasDisplay(x,y);
					if(this.status==0){
						if(!o){
							o=moonjs.createDisplay('circle').setXY(x,y).setAlpha(this.alpha).setRadius(8);
							o.addChild(moonjs.createDisplay('circle').setRadius(1.5));
							this.addInput(o.id);
							this.createShape();
						}
					}else if(this.status==2){
						if(o){
							let hasNum=0;
							for(let o of moonjs.map.values()){
								if(o.alpha==this.alpha){
									hasNum++;
								}
							}
							if(hasNum>3){
								moonjs.map.delete(o.id);
								let txt=this.inputs.find((t)=>t.id==o.id);
								this.inputs.splice(this.inputs.indexOf(txt),1);
								txt.visible=false;
								txt=null;
								this.updateTxtPos();
								this.createShape();
							}else{
								TipsManager.alert('不能再删除了');
							}
						}
					}
				}					
			},false);
		}
		setData(data){
			if(this.isShow){
				if(this.inputs.length>0){
					this.image=this.moonjs.createDisplay('image').createImage(data).setXY(400,100);
				}else{
					TipsManager.alert('先点创建');
				}
			}
		}
		addInput(id){
			let i=this.inputs.length+1;
			let txt=new LabelInput(this.p,5,5,'第'+i+'个点');
			txt.id=id;
			console.log(txt.id);
			this.inputs.push(txt);
			this.updateTxtPos();
		}
		updateTxtPos(){
			let len=this.inputs.length;
			for(let i=0;i<len;i++){
				let txt=this.inputs[i];
				txt.x=5;txt.y=70+i*22;
			}
		}
		dragUpdate(){
			this.createShape();
		}
		createShape(){
			let shapes=[];
			let i=0;
			let moonjs=this.moonjs;
			for(let o of moonjs.map.values()){
				if(o.alpha==this.alpha){
					shapes.push([o.x,o.y]);
					this.inputs[i++].input.text=o.x+','+o.y;
				}
			}
			shapes.push(shapes[0]);
			moonjs.map.delete(this.shapeId);
			this.shapeId=moonjs.createDisplay('polygon').setPoint({x:0,y:0}).setAlpha(0.5).setColor(this.color).setSides(shapes).id;
			let txts=[];
			shapes.forEach((s)=>{
				txts.push([s[0]-this.centerPos.x,s[1]-this.centerPos.y]);
			})
			let str='[';
			let len=this.isBox2d?(txts.length-1):(txts.length);
			for(i=0;i<len;i++){
				str+='['+txts[i][0]+','+txts[i][1]+'],'
			}
			str=str.substr(0,str.length-1)+']';
			if(this.isBox2d){
				this.txtOut.text=`var varr=mb.getPolygonOtherPoints(${str});\nvar body=mb.createPolygon3(100,100,varr);`;
			}else{
				this.txtOut.text=`let polygon=moonjs.createDisplay('polygon');\npolygon.setSides(${str});\npolygon.setColor('${this.color}');`;
			}
			
		}
	}
	
	//-----------------box2d场景-----------------
	class CreateBox2dPanel extends BasicPanel{
		constructor(label){
			super(label);
			this.alpha=0.4;
			this.red='#ff0000';
			this.green='#00ff00';
			this.HCopy=true;
			this.status=0;
			this.gap=3;
			this.initView();
			this.initEvent();
			this.initMoonBit101();
			this.setDataWindow();
		}
		initMoonBit101(){
			this.moonjs=new MoonBit101();
			this.moonjs.init(this.canvas);
			this.moonjs.setGapXY(this.p.offsetLeft,this.p.offsetTop);
			this.moonjs.start();
			this.moonjs.startDrag();
		}
		initView(){
			this.canvas=new Canvas(this.p, 150, 0,width-260,height-30);
			let [x,y,g]=[5,5,++group];
			let arr=['创建方形','创建圆形','创建三角边形','只可以拖动操作','只可以删除操作'];
			for(let i=0;i<arr.length;i++){
				new RadioButton(this.p, x, y+i*18, g, arr[i], i==0, (e)=>{
					if(e.detail===arr[0])		this.status=0;
					else if(e.detail===arr[1])	this.status=1;
					else if(e.detail===arr[2])	this.status=2;
					else if(e.detail===arr[3])	this.status=3;
					else if(e.detail===arr[4])	this.status=4;
				});
			}
			y+=140;
			let arr2=['修改宽','修改高','修改半径'];
			let [min,max]=[1,800];
			let control=null;
			this.controls=[];
			for(let i=0;i<arr2.length;i++){
				control=new VSlider(this.p, x+10+50*i, y, arr2[i],min,min,max,(e)=>{
					let value=e.detail;
					let shape=this.currShape;
					if(shape&&(value>=min&&value<=max)){
						if(e.target.label==arr2[0]){//宽
							shape.w=value;
						}else if(e.target.label==arr2[1]){//高
							shape.h=value;
						}else if(e.target.label==arr2[2]){//半径
							shape.r=value;
						}
					}
				});
				this.controls.push(control);
			}
			y+=200;
			control=new Knob(this.p, x+50, y, '修改角度',0,0,360,(e)=>{
				let value=e.detail;
				let shape=this.currShape;
				if(shape){
					shape.a=value;
				}
			});
			this.controls.push(control);
			y+=65;
			this.txtX=new LabelInput(this.p,x,y,'x轴',(e)=>{this.gap=parseInt(e.detail);}).setInputSize(40)
			this.txtX.input.text='0';
			this.txtY=new LabelInput(this.p,x+75,y,'y轴',(e)=>{this.gap=parseInt(e.detail);}).setInputSize(40)
			this.txtY.input.text='0';
			y+=15;
			control=new Toggle(this.p, x+60, y+20, '是否静态',true,(e)=>{
				let value=e.detail;
				let shape=this.currShape;
				if(shape){
					shape.color=value?this.green:this.red;
				}
			});
			this.controls.push(control);
			
			y+=60;
			control=new Toggle(this.p, x+80, y, '是否横项复制',true,(e)=>{this.HCopy=e.detail;});
			y+=30;
			new LabelInput(this.p,x,y,'形状间距离',(e)=>{this.gap=parseInt(e.detail);}).setInputSize(60).input.text=this.gap;
			y+=30;
			new Button(this.p,x+20,y,'复制当前形状',this.copyHandler.bind(this));
			y+=30;
			new Button(this.p,x+20,y,'生成代码',this.createJsCode.bind(this));
			y+=30;
			var canWid=new LabelInput(this.p,x,y,'布宽',(e)=>{this.gap=parseInt(e.detail);}).setInputSize(40)
			canWid.input.text=this.canvas.width;
			var canHei=new LabelInput(this.p,x+75,y,'布高',(e)=>{this.gap=parseInt(e.detail);}).setInputSize(40)
			canHei.input.text=this.canvas.height;
			y+=30;
			new Button(this.p,x+20,y,'修改画布',(e)=>{this.canvas.width=canWid.input.text;this.canvas.height=canHei.input.text;});
		}
		initEvent(){
			this.canvas.addEventListener("click",(e)=>{
				let [x,y]=[e.layerX,e.layerY];
				let [w,h,r]=[30,30,15];
				let types=['rect','circle','polygon'];
				let type=types[this.status];
				let moonjs=this.moonjs;
				this.currShape=moonjs.checkHasDisplay(x,y);
				if(this.status<=2){
					if(!this.currShape){
						this.currShape=moonjs.createDisplay(type).setXY(x,y).setAlpha(this.alpha).setColor(this.green);
					}
				}else if(this.status==4){
					this.currShape&&moonjs.map.delete(this.currShape.id);
				}
				this.changeControls(this.currShape);
				this.copyCount=0;
				//console.log(x,y);
				//console.log(this.status);
			},false);
		}
		changeControls(shape){
			if(shape){
				for(let i=0;i<this.controls.length;i++){
					let control=this.controls[i];
					switch(i){
						case 0:control.value=shape.w;break;
						case 1:control.value=shape.h;break;
						case 2:control.value=shape.r;break;
						case 3:control.value=shape.a;break;
						case 4:control.toggled=shape.color==this.green;break;
					}
				}
			}
		}
		copyHandler(){
			let shape=this.currShape
			if(shape){
				this.copyCount++;
				let [x,y,w,h,r,t,a]=[shape.x,shape.y,shape.w,shape.h,shape.r,shape.type,shape.a];
				if(this.HCopy) 	x+=this.copyCount*(w+this.gap);
				else			y+=this.copyCount*(h+this.gap);
				//console.log(x,y,w,h,r,t)
				this.moonjs.createDisplay(t).setXY(x,y).setAlpha(this.alpha).setColor(shape.color).setWH(w,h).setRadius(r).setAngle(a);
			}
		}
		createJsCode(){
			let len=0;
			let [tx,ty]=[Number(this.txtX.input.text),Number(this.txtY.input.text)];
			let str='let datas=[';
			for(let shape of this.moonjs.map.values()){
				//x,y,宽,高,半径,形状类型,角度,动态类型
				len++;
				let [x,y,w,h,r,t,a,s]=[shape.x+tx,shape.y+ty,shape.w,shape.h,shape.r,shape.type,shape.a,shape.color==this.green?0:2];
				str+=`[${parseInt(x)},${parseInt(y)},${parseInt(w/2)},${parseInt(h/2)},${parseInt(r)},'${t}',${a},${s}],\n`
			}
			str=str.substr(0,str.length-2);
			str+=']\n'
			str+=`for(let i=0;i<${len};i++){
	let as=datas[i];
	let [x,y,w,h,r,t1,a,t2]=[as[0],as[1],as[2],as[3],as[4],as[5],as[6],as[7]]
	let body=mb.createBody({t1:t1,x:x,y:y,w:w,h:h,r:r,t2:t2});
	mb.setAngle(body,a);
}`
			this.dataWindow.setContent(str);
		}
	}
	//-----------------画图大师-----------------
	class DrawToolPanel extends BasicPanel{
		constructor(label){
			super(label);
			this.alpha=1;
			this.color='#ff0000';
			this.size=1;
			this.initView();
			this.initEvent();
		}
		initView(){
			this.canvas=new Canvas(this.p, 150, 0,width-260,height-30);
			this.realityCanvas=this.canvas.realityCanvas;
			new ColorPicker(this.p,10,20,'画笔颜色选择',null,(e)=>{this.color=e.detail});
			new HSlider(this.p,10,60,'画笔粗细选择',this.size, 1, 20,(e)=>{this.size=e.detail}).setSize(130);
			new HSlider(this.p,10,100,'画笔透明度选择',this.alpha*100, 0, 100,(e)=>{this.alpha=e.detail/100}).setSize(130);


			this.status=0;
			let [x,y,g]=[10,130,++group];
			let arr=['选择自由笔刷','选择直线笔刷','选择方形笔刷','选择圆形笔刷','选择橡皮擦'];
			for(let i=0;i<arr.length;i++){
				new RadioButton(this.p, x, y+i*18, g, arr[i], i==0, (e)=>{
					if(e.detail===arr[0])		this.status=0;
					else if(e.detail===arr[1])	this.status=1;
					else if(e.detail===arr[2])	this.status=2;
					else if(e.detail===arr[3])	this.status=3;
					else if(e.detail===arr[4])	this.status=4;
				});
			}
			
			let labels=[];
			this.layers=[];
			for(let i=0;i<5;i++){
				labels.push('图层 '+(i+1));
				this.layers.push(new createjs.Container());
			}
			let tabbarButton=new TabbarButton(this.p,10,250,labels,0,(e)=>{this.layer=this.layers[e.detail];});
			tabbarButton.layout(1);
			tabbarButton.selectIndex(0);

			new HSlider(this.p,10,380,'图层的透明度',100, 0, 100,(e)=>{
				this.layer.children.map((a)=>{
					a.alpha=e.detail/100;
				})
				this.stage.update();
			}).setSize(130);

			y=400;
			new Button(this.p,10,y+=25,'删除此图层',(e)=>{this.layer.removeAllChildren();this.stage.update();});
			new Button(this.p,10,y+=25,'保存图片',(e)=>{Canvas2Image.saveAsJPEG(this.realityCanvas, this.realityCanvas.width, this.realityCanvas.height)});
			new ColorPicker(this.p,10,y+=50,'修改背景色','#fff',(e)=>{this.createBg(e.detail)});
		}
		initEvent(){
			this.stage=new createjs.Stage(this.realityCanvas);
			this.stage.addEventListener("stagemousedown", this.handleMouseDown.bind(this));
			this.stage.addEventListener("stagemousemove", this.handleMouseMove.bind(this));
			this.stage.addEventListener("stagemouseup", this.handleMouseUp.bind(this));
			
			this.layers.forEach((e)=>{this.stage.addChildAt(e,0)});
			this.layer=this.layers[0];
			this.node=null;
			this.pen=null;
			this.points=[];
			this.beginPoint={};
			
			this.createBg('#ffffff');
		}
		getPos(evt) {
			return {
				x: evt.stageX,
				y: evt.stageY
			}
		}
		handleMouseDown(event) {
			if(this.status==4){//擦除
				let children=this.layer.children;
				for(let i=0;i<children.length;i++){
					let shape=children[i];
					if(shape.hitTest(event.stageX, event.stageY)){
						this.layer.removeChild(shape);
						break;
					}
				}
				return;
			}
			this.node=new createjs.Shape();
			this.node.graphics.beginStroke(this.color);
			this.node.graphics.moveTo(event.stageX,event.stageY);
			this.node.graphics.setStrokeStyle(this.size,1,1);
			this.node.alpha=this.alpha;
			this.layer.addChild(this.node);
			this.createPen(event.stageX,event.stageY);

			const { x, y } = this.getPos(event);
			this.points=[{x, y}];
			this.beginPoint = {x, y};
		}
		handleMouseMove(event) {
			if(this.node){
				let beginPoint=this.beginPoint;
				let [sx,sy,ex,ey]=[beginPoint.x,beginPoint.y,event.stageX,event.stageY]
				if(this.status==0){//自由线
					const { x, y } = this.getPos(event);
					this.points.push({x, y});
					let points=this.points;
					if (points.length > 3) {
						const lastTwoPoints = points.slice(-2);
						const controlPoint = lastTwoPoints[0];
						const endPoint = {
							x: (lastTwoPoints[0].x + lastTwoPoints[1].x) / 2,
							y: (lastTwoPoints[0].y + lastTwoPoints[1].y) / 2,
						}
						this.node.graphics.quadraticCurveTo(controlPoint.x, controlPoint.y, endPoint.x, endPoint.y);
						this.node.graphics.lineTo(endPoint.x,endPoint.y);
						beginPoint = endPoint;
					}
				}else if(this.status==1){//直线
					this.node.graphics.clear();
					this.node.graphics.beginStroke(this.color);
					this.node.graphics.setStrokeStyle(this.size,1,1);
					this.node.graphics.moveTo(sx,sy).lineTo(ex,ey);
				}else if(this.status==2){//方形
					this.node.graphics.clear().beginFill(this.color).drawRect(sx,sy,ex-sx,ey-sy);
				}else if(this.status==3){//圆形
					let r=Math.hypot(ex-sx,ey-sy);
					this.node.graphics.clear().beginFill(this.color).drawCircle(sx,sy,r);
				}
				this.pen.x=event.stageX;this.pen.y=event.stageY;
				this.stage.update();
			}
		}
		handleMouseUp(event) {
			this.node=null;
			if(this.pen){
				this.pen.parent.removeChild(this.pen);
				this.pen=null;
			}
			this.stage.update();
		}
		createPen(x,y){
			this.pen=new createjs.Shape();
			this.pen.graphics.beginFill(this.color);
			this.pen.graphics.drawCircle(0,0,this.size/2);
			this.layer.addChild(this.pen);
		}
		createBg(color){
			if(!this.bg){
				this.bg=new createjs.Shape();
				this.bg.graphics.beginFill(color).drawRect(0,0,this.canvas.width,this.canvas.height);
				this.stage.addChildAt(this.bg,0);
			}else{
				this.bg.graphics.clear().beginFill(color).drawRect(0,0,this.canvas.width,this.canvas.height);
			}
			this.stage.update();
		}
	}
	//-----------------地图编辑大师-----------------
	class MapToolPanel extends BasicPanel{
		constructor(label){
			super(label);
			this.propBtns=[];
			this.initView();
			this.initEvent();

			this.createMap({detail:true});//测试
		}
		initView(){
			this.canvas=new Canvas(this.p, 150, 0,width-260,height-30);
			this.realityCanvas=this.canvas.realityCanvas;
			var [x,y]=[5,-10];
			this.xTxt=new LabelInput(this.p,5,y+=22,'x轴数量').input;
			this.xTxt.setSize(50).text=10;
			this.yTxt=new LabelInput(this.p,5,y+=22,'y轴数量').input;
			this.yTxt.setSize(50).text=10;
			this.wMap=new LabelInput(this.p,5,y+=22,'小地图宽').input;
			this.wMap.setSize(50).text=25;
			new Button(this.p,x,y+=22,'创建地图',(e)=>{TipsManager.SureCancel(`确定创建${this.xTxt.text}x${this.yTxt.text}的地图吗？`,this.createMap.bind(this))});
			
			this.colors=['rgba(255,255,0,0.1)','#FF0000','#ffaa00','#fa5500','#BB3300','#666600','#660000','#333399','#006666','#006633','#003300','#0033ff'];
			this.status=1;
			var [x,y,g,radios]=[5,110,++group,[]];
			this.inputs=[];
			let arr=['清除数据','使用数据1','使用数据2','使用数据3','使用数据4','使用数据5','使用数据6','使用数据7','使用数据8'];
			for(let i=0;i<arr.length;i++){
				radios.push(new RadioButton(this.p, x, (y+=22)+4, g, arr[i], i==1, (e)=>{
					this.status=radios.indexOf(e.target);
				}));
				this.inputs.push(new TextInput(this.p,x+80,y,i,this.onInput.bind(this)).setSize(30));
			}
			new Button(this.p,x,y+=22,'生成数据',this.createData.bind(this));
			
			this.posLabel=new LabelInput(this.p,5,y+=44,'角色位置').input;
			this.posLabel.setSize(50).text='1,1';
			new Button(this.p,x,y+=22,'生成角色',this.createRole.bind(this));
			y+=22;
			let btnNames=Object.entries(Const);
			let i=0;
			btnNames.forEach(a=>{
				new Button(this.p,5+22*(i++),y,a[1],(e)=>{this.controlRole(e.target.label)}).setSize(22);
			})
			this.roleSpeed=1;
			new HSlider(this.p,5,y+=44,'角色速度选择',this.roleSpeed, 1, 100,(e)=>{this.roleSpeed=e.detail;this.loop=Const.STOP}).setSize(130);

			new Toggle(this.p, x+60, y+=20, '是否编辑',false,(e)=>{	this.isEdit=e.detail;	});
			new Button(this.p, x+6, y+=25, '生成JSON数据',(e)=>{	this.createJson();	});
			new Button(this.p,x+6,y+=22,'45度游戏编辑器',(e)=>{window.open('./game45Editer.html','_blank');});
			new Button(this.p,x+6,y+=22,'无人探索编辑器',(e)=>{window.open('./gameMapEditer2.html','_blank');});
			new Button(this.p,x+6,y+=22,'推箱子地图辑器',(e)=>{window.open('./gameMapEditer3.html','_blank');});
			let keyLabel=new LabelInput(this.p,x,y+=25,'按键值').input;
			keyLabel.setSize(100).text='A=65';

			this.setDataWindow();

			window.keyDownData['MapToolPanel']=(e)=>{
				this.updateKeyDown(e.key);
				keyLabel.text=e.key+'='+e.keyCode;
			}
			window.keyUpData['MapToolPanel']=(e)=>{
				this.updateKeyUp(e.key);
			}
		}
		onInput(e){
			let i=this.inputs.indexOf(e.target);
			let text=e.detail;
			this.maps.forEach((a)=>{
				if(a.data.id==i){
					a.data.text=text;
					a.update();
				}
			})
			this.stage.update();
		}
		initEvent(){
			this.stage=new createjs.Stage(this.realityCanvas);
			this.stage.addEventListener("stagemousedown", this.handleMouseDown.bind(this));
			this.stage.addEventListener("stagemousemove", this.handleMouseMove.bind(this));
			this.stage.addEventListener("stagemouseup", this.handleMouseUp.bind(this));
			this.createBg('#ffffff');
			this.mapLayer=new createjs.Container();
			this.stage.addChild(this.mapLayer);
		}
		handleMouseDown(event) {
			this.isDown=true;
			this.drawData={color:this.colors[this.status],text:this.inputs[this.status].text,id:this.status};
			const { x, y } = this.getPos(event);
			this.handleMouseMove(event);
			if(this.isEdit){
				if(this.isDown){
					const { x, y } = this.getPos(event);
					let len=this.maps.length;
					for(var i=0;i<len;i++){
						let a=this.maps[i];
						if(a.data.id>0&&a.hitTest(x, y)){
							if(this.dataEditWindow==null){
								this.dataEditWindow=new DataEditWindow(document.body,0,0);
							}else{
								this.dataEditWindow.addFromParent();
							}
							this.dataEditWindow.setData(a);
							break;
						}
					}
				}
			}
		}
		handleMouseMove(event) {
			if(this.isEdit)return;
			if(this.isDown){
				const { x, y } = this.getPos(event);
				let len=this.maps.length;
				for(var i=0;i<len;i++){
					let a=this.maps[i];
					if(a.hitTest(x, y)){
						a.setData(this.drawData);
						this.stage.update();
						break;
					}
				}
			}
		}
		handleMouseUp(event) {
			this.isDown=false;
			this.stage.update();
		}
		createRole(){
			if(this.mapDatas){
				if(this.role) this.mapLayer.removeChild(this.role);
				let [x,y]=this.posLabel.text.split(',');
				let role=new MapItem(this.minMapWid,this.minMapWid);
				role.x=Number(x)*this.minMapWid;
				role.y=Number(y)*this.minMapWid;
				role.drawBox('#0');
				role.prevPos={x:role.x,y:role.y};
				role.pos=[x,y];
				this.mapLayer.addChild(role);
				this.role=role;
				this.stage.update();
			}
		}
		controlRole(t){
			if(this.role){
				this.loop=t;
				console.log(this.loop);
				clearTimeout(this.clearTime);
				if(this.loop==Const.STOP){
					this.setRoleNext();
					return;
				}
				let [x,y]=this.role.pos;
				//let map=this.mapDatas[x][y];
				if(this.loop==Const.LEFT||this.loop==Const.RIGHT){
					this.roads=this.mapDatas[y];
				}else{
					this.roads=[];
					let [xNum,yNum]=[this.mapDatas.length,this.mapDatas[0].length];
					for(let i=0;i<xNum;i++){
						this.roads.push(this.mapDatas[i][x]);
					}
				}
				this.roads.forEach(a=>{console.log(a.data)});
				this.updateRole();
			}
		}
		updateRole(){
			//console.log(this.loop);
			if(this.loop==Const.STOP){
				this.setRoleNext();
				return;
			}else{
				this.clearTime=setTimeout(this.updateRole.bind(this),30);
			}
			let map=this.nextMap;
			if(!map){
				[this.sx,this.sy]=[0,0];
				let [x,y]=this.role.pos;
				if(this.loop==Const.UP) 		{y--;this.sy=-1;}
				else if(this.loop==Const.DOWN) 	{y++;this.sy= 1;}
				else if(this.loop==Const.LEFT) 	{x--;this.sx=-1;}
				else if(this.loop==Const.RIGHT) {x++;this.sx= 1;}
				if(this.loop==Const.LEFT||this.loop==Const.RIGHT) map=this.roads[x];
				else 											  map=this.roads[y];
				this.nextMap=map;
			}
			//console.log('x',x,map);
			if(map&&map.data.id==0){
				let sv=this.minMapWid/100*this.roleSpeed;
				this.role.x+=sv*this.sx;
				this.role.y+=sv*this.sy;
				if(Math.floor(Math.hypot(map.x-this.role.x,map.y-this.role.y))<=Math.floor(sv)){
					this.setRoleNext();
				}
			}else{
				this.loop=Const.STOP;
				this.nextMap=null;
			}
			this.stage.update();
		}
		updateKeyDown(key){
			if(!this.role)return;
			if(key!=this.currKey){
				this.currKey=key;
				let [x,y]=this.role.pos;
				if(key==ConstKey.A||key==ConstKey.D){
					this.roads=this.mapDatas[y];
				}else{
					this.roads=[];
					let [xNum,yNum]=[this.mapDatas.length,this.mapDatas[0].length];
					for(let i=0;i<xNum;i++){
						this.roads.push(this.mapDatas[i][x]);
					}
				}
			}
			let map=this.nextMap;
			if(!map){
				[this.sx,this.sy]=[0,0];
				let [x,y]=this.role.pos;
				if(key==ConstKey.W) 		{y--;this.sy=-1;}
				else if(key==ConstKey.S) 	{y++;this.sy= 1;}
				else if(key==ConstKey.A) 	{x--;this.sx=-1;}
				else if(key==ConstKey.D)    {x++;this.sx= 1;}
				if(key==ConstKey.A||key==ConstKey.D)  	map=this.roads[x];
				else 									map=this.roads[y];
				this.nextMap=map;
			}
			//console.log('x',x,map);
			if(map&&map.data.id==0){
				let sv=this.minMapWid/100*this.roleSpeed;
				this.role.x+=sv*this.sx;
				this.role.y+=sv*this.sy;
				if(Math.floor(Math.hypot(map.x-this.role.x,map.y-this.role.y))<=Math.floor(sv)){
					this.setRoleNext();
				}
				this.stage.update();
			}else{
				this.nextMap=null;
			}
		}
		updateKeyUp(key){
			this.setRoleNext();
			this.stage.update();
		}
		setRoleNext(){
			if(this.nextMap&&this.nextMap.data.id==0){
				if(Math.floor(Math.hypot(this.role.prevPos.x-this.role.x,this.role.prevPos.y-this.role.y))<=this.minMapWid*0.8){//当小于这个距离时自动自加移动到下个位置
					let sv=this.minMapWid*0.1;
					this.role.x+=sv*this.sx;
					this.role.y+=sv*this.sy;
					setTimeout(this.setRoleNext.bind(this),30);
					this.stage.update();
					return;
				}else{
					this.role.x=this.nextMap.x;
					this.role.y=this.nextMap.y;
					this.role.pos=this.nextMap.pos;
					this.role.prevPos={x:this.role.x,y:this.role.y};
				}
				this.nextMap=null;
				this.stage.update();
			}
		}
		getPos(evt) {
			return {
				x: evt.stageX,
				y: evt.stageY
			}
		}
		createMap(e){
			if(e.detail){
				this.mapLayer.removeAllChildren();
				const [ x, y ,w] = [Number(this.xTxt.text),Number(this.yTxt.text),Number(this.wMap.text)];
				this.maps=[];
				this.mapDatas=[];
				for(let i=0;i<y;i++){
					this.mapDatas.push([]);
					for(let j=0;j<x;j++){
						let map=new MapItem(w,w);
						map.pos=[j,i];
						this.mapLayer.addChild(map);
						this.maps.push(map);
						this.mapDatas[i].push(map);
					}
				}
				Unify.displayRank(this.maps,x);
				this.stage.update();
				this.minMapWid=w;
			}			
		}
		createData(){
			if(!this.mapDatas)return;
			var objs=[];
			var objStr='[\n';
			var arr=[];
			var arrStr='[\n';
			const [ x, y] =[this.mapDatas.length,this.mapDatas[0].length]; 
			for(let i=0;i<x;i++){
				let maps=this.mapDatas[i];
				objs.push([]);
				arr.push([]);
				arrStr+='['
				objStr+='['
				for(let j=0;j<y;j++){
					let m=maps[j];
					objs[i].push(m.data);
					objStr+=JSON.stringify(m.data)+',';
					arr[i].push(m.data.id);
					arrStr+=m.data.id+',';
				}
				arrStr+='],\n'
				objStr+='],\n'
			}
			arrStr+=']';
			objStr+=']';
			//console.log(str);
			//console.log(objs);
			//console.log(arr);
			this.dataWindow.setContent(arrStr);
		}
		createJson(){
			var value="{"+'"'+"size"+'":"'+this.mapDatas[0].length+','+this.mapDatas.length+',32",'
			this.maps.forEach((item)=>{
				if(item.data.id){
					var o={config:item.data.config,event:item.data.event};
					if(o.config){
						var v='"'+item.pos.toString()+'":'+JSON.stringify(o)+',';
						value+=v;
					}
				}
			});
			value=value.substr(0,value.length-1);
			value+="}";
			this.dataWindow.setContent(value);
		}
		createBg(color){
			if(!this.bg){
				this.bg=new createjs.Shape();
				this.bg.graphics.beginFill(color).drawRect(0,0,this.canvas.width,this.canvas.height);
				this.stage.addChildAt(this.bg,0);
			}else{
				this.bg.graphics.clear().beginFill(color).drawRect(0,0,this.canvas.width,this.canvas.height);
			}
			this.stage.update();
		}
	}
	class DataEditWindow extends Window{
		constructor(parent, xpos, ypos)
		{
			super(parent, xpos, ypos);
			let w=200;
			this.setSize(w,w);
			this.x=(width-w)/2;
			this.y=(height-w)/2;
			this.createText();
			this.draggable=false;
		}
		createText(){
			var names=['id','事件','参数','配置'];
			var h=30;
			var win=this;
			for(var i=0;i<names.length;i++){
				new Label(this,0,i*h,names[i]);
				switch(i){
					case 0:
						this.txtId=new TextInput(win,50,i*h);
						this.txtId.setSize(100,26);
						break;
					case 1:
						this.txtEvent=new TextInput(win,50,i*h);
						this.txtEvent.setSize(100,26);
						break;
					case 2:
						this.txtParam=new TextInput(win,50,i*h);
						this.txtParam.setSize(100,26);
						break;
					case 3:
						this.txtConfig=new TextInput(win,50,i*h);
						this.txtConfig.setSize(100,26);
						break;
				}
			}
		}
		setData(item){
			this.item=item;
			this.txtId.text=this.item.data.id;
			this.txtEvent.text=this.item.data.event;
			this.txtParam.text=this.item.data.param;
			this.txtConfig.text=this.item.data.config;
		}
		removeFromParent()
		{
			this.item.data.id=this.txtId.text;
			this.item.data.event=this.txtEvent.text;
			this.item.data.param=this.txtParam.text;
			this.item.data.config=this.txtConfig.text;
			this.item.update();
			super.removeFromParent();
		}
	}
	customElements.define("minimal-window99", DataEditWindow);
	class MapItem extends createjs.Container{
		constructor(w,h){
			super();
			this.data={id:0};
			this.width=w;
			this.height=h;
			this.shape=new createjs.Shape();
			this.colorBg="rgba(255,255,0,0.1)";
			this.colorMap="rgba(255,0,0,1)";
			this.drawBox(this.colorBg);
			this.addChild(this.shape);
			this.label=new createjs.Text('',"15px Arial", "#ffffff");
			this.label.x=3;
			this.label.y=3;
			this.label.textAlign='left';
			this.addChild(this.label);
		}
		drawBox(color){
			let[w,h]=[this.width,this.height];
			this.shape.graphics.clear();
			this.shape.graphics.setStrokeStyle(1);
			this.shape.graphics.beginStroke("black");
			this.shape.graphics.beginFill(color).drawRect(0,0,w,h);
		}
		hitTest(x,y){
			if(x>=this.x&&x<=this.x+this.width){
				if(y>=this.y&&y<=this.y+this.height){
					return true;
				}
			}
			return false;
		}
		setData(data){
			this.data.id=data.id;
			this.data.text=data.text;
			this.data.color=data.color;
			this.data.event=data.event;
			this.data.param=data.param;
			this.data.config=data.config;
			this.update();
		}
		update(){
			this.label.text=this.data.text||'';
			this.drawBox(this.data.color);
		}
	}
	//-----------------图片压缩-----------------
	class ImageToolPanel extends BasicPanel{
		constructor(label){
			super(label);		
			this.canvas=new Canvas(this.p, 150, 0,width-260,height-30);
			this.realityCanvas=this.canvas.realityCanvas;
			let y=0;
			let x=10;
			new Label(this.p,x,y+=22,'目前jpg才能改变质量')
			this.slider1=new HSlider(this.p,x,y+=44,'图片质量选择',100, 1, 100,(e)=>{this.quality=e.detail/100;this.update()}).setSize(130);
			this.slider2=new HSlider(this.p,x,y+=44,'图片尺寸选择',100, 1, 100,(e)=>{this.scale=e.detail/100;this.update()}).setSize(130);
			new Button(this.p,x,y+=44,'保存图片',(e)=>{imageConversion.downloadFile(this.imgData,['fileName'])});

			y+=44;
			let g=++group;
			let arr=['不转jpg','转jpg'];
			for(let i=0;i<arr.length;i++){
				new RadioButton(this.p, x+i*60, y, g, arr[i], i==0, (e)=>{
					if(e.detail==arr[0]){
						this.isToJPG=false;
					}else{
						this.isToJPG=true;
					}
				});
			}
			y+=44;
			this.oldLabel	=new Label(this.p,x,y+=22,'原图宽高');
			this.oldLabel2	=new Label(this.p,x,y+=22,'原图大小');
			this.newLabel	=new Label(this.p,x,y+=22,'新图宽高');
			this.newLabel2	=new Label(this.p,x,y+=22,'新图大小');
			new Button(this.p,x,y+=100,'打开压缩PNG',(e)=>{window.open('https://ywx620.gitee.io/learn/gameTool/yasuoPng/index.html','_blank');});

			this.imgEle=document.createElement('img');
		}
		update(){
			let file=this.data.file;
			let ctx=this.realityCanvas.getContext("2d");
			var type='image/png';
            if(file.name.includes('.jpg')) 		type='image/jpeg';
			else if(file.name.includes('.gif')) type='image/gif';
			if(this.isToJPG) type='image/jpeg';//强制转为jpg
			imageConversion.compress(file,{quality:this.quality,scale:this.scale,type:type}).then(res=>{
				this.imgData=res;
                imageConversion.filetoDataURL(res).then(res=>{
                    imageConversion.dataURLtoImage(res).then(res=>{
						this.imgWidth=res.width;
						this.imgHeight=res.height;
						
						ctx.clearRect(0, 0, this.realityCanvas.width, this.realityCanvas.height);
                        ctx.drawImage(res,0,0,res.width,res.height);
						//console.log(this.imgData)
						this.newLabel.text=`新图:宽${res.width},高${res.height}`;
						this.newLabel2.text=`新图:${parseInt(this.imgData.size/1024)}k`;
                    });
                })
        　　})
		}
		setData(data){
			this.data=data;
			this.quality=1;
			this.scale=1;
			this.slider1.value=100;
			this.slider2.value=100;
			this.imgEle.src=data.data;
			setTimeout(()=>{
				this.oldLabel.text=`原图:宽${this.imgEle.width},高${this.imgEle.height}`;	
				this.oldLabel2.text=`原图:${parseInt(data.file.size/1024)}k`;
			},500);
			
			this.update();
		}
	}
	//-----------------Tween缓动-----------------
	class TweenToolPanel extends BasicPanel{
		constructor(label){
			super(label);		
			this.canvas=new Canvas(this.p, 5, 0,width-120,height-380);
			this.realityCanvas=this.canvas.realityCanvas;
			this.initStage();
			this.initSet();
		}
		initSet(){
			let [x,y]=[5,370];
			this.txtCode=new MoonTextArea(this.p,x,y).setSize(width-120,220);
			this.txtCode.text='TweenMax.to(this.boxRed,3,{x:400,y:150,rotation:360,ease:Bounce.easeOut})';
			this.txtCode.fontSize = 16;

			this.easeTypes=['Bounce.easeOut','Elastic.easeOut','Back.easeOut','Expo.easeOut','Circ.easeOut','SlowMo.ease.config(0.7,0.7, false)','Sine.easeOut','SteppedEase.config(12)'];
			

			y+=225;
			new Button(this.p,x,y,'开始',this.onStart.bind(this));
			new Button(this.p,x+=100,y,'重置',this.onReset.bind(this));
			new Button(this.p,x+=100,y,'使用说明',this.onHelp.bind(this));
			new Button(this.p,x+=100,y,'曲线帮助',this.onEase.bind(this));
			new Button(this.p,x+=100,y,'蓝色块',this.onCreateBlue.bind(this));
			new Button(this.p,x+=100,y,'绿色块',this.onCreateGreen.bind(this));
			new HSlider(this.p,850,620,'播放数度(time/50)',50, 0, 100,this.onTimeScale.bind(this));
			
			x=-95;y+=25;
			let names=['模拟落地弹起','像弹簧来回弹','超出再回来','先快到后慢','Circ','SlowMo','Sine','SteppedEase'];
			for(let i=0;i<names.length;i++){
				let btn=new Button(this.p,x+=100,y,names[i],this.onClick.bind(this));
				btn.name=String(i);
			}
			new Dropdown(this.p, 500, 348, names, 0, this.onListHandler.bind(this));
			this.txtEase=new TextInput(this.p, 600, 348,'').setSize(150);
			names=['开始函数','每帧触发函数','完成函数','时间线函数'];
			new Dropdown(this.p, 760, 348, names, 0, this.onListHandler2.bind(this));
			this.txtCallBack=new TextInput(this.p, 860, 348,'').setSize(250);

			x=-95;y+=25;
			names=['时间线动画','正放','重头开始','暂停','恢复','倒放','重复无数次','yoyo'];
			for(let i=0;i<names.length;i++){
				let btn=new Button(this.p,x+=100,y,names[i],this.onClick2.bind(this));
				btn.name=String(i);
			}
		}
		onClick(e){
			let i=parseInt(e.target.name);
			this.txtCode.text=`TweenMax.to(this.boxRed,3,{x:400,y:150,ease:${this.easeTypes[i]}})`;
			this.onStart();
		}
		onListHandler(e){
			//console.log(e);
			let i=e.detail.index;
			this.txtEase.text=`ease:${this.easeTypes[i]}`;
		}
		onListHandler2(e){
			let types=['onStart:函数,onStartParams:参数','onUpdate:函数,onUpdateParams:参数','onComplete:函数,onCompleteParams:参数','.call(函数)']
			let i=e.detail.index;
			this.txtCallBack.text=`${types[i]}`;
		}
		onStart(e){
			this.onReset();
			TimeFactory.createGameTime('TweenToolPanel',this.update.bind(this));
			eval(this.txtCode.text);
		}
		onReset(e){
			if(this.tm){
				this.tm.kill();
				if(this.tm.clear)this.tm.clear(true);
			}
			TimeFactory.removeTime('TweenToolPanel');
			let a=this.boxRed;//set是没有时间的直接起作用
			TweenMax.set(a,{x:a.ox,y:a.oy,scale:1,alpha:1,rotation:0,onUpdate:this.update.bind(this)})
		}
		onHelp(e){
			window.open('https://www.tweenmax.com.cn/api/tweenmax/','_blank');
		}
		onEase(e){
			window.open('https://greensock.com/docs/v2/Easing/Back','_blank');
		}
		onClick2(e){
			let i=parseInt(e.target.name);
			if(i==0){
				this.onTimeLine();
			}else{
				let types=['','play','restart','pause','resume','reverse','repeat','yoyo'];
				if(this.tm){
					if(i<=5){
						this.tm[types[i]]()
					}
				}
				if(i==6){
					this.txtCode.text=`//也可以new TimelineMax({repeat:1});repeat重复次数，-1为无数次
this.tm = new TimelineMax();
this.tm.repeat(-1);
this.tm.to(this.boxRed,1,{x:400}).to(this.boxRed,1,{y:300}).to(this.boxRed,1,{x:50}).to(this.boxRed,1,{y:150});
`;
				}else if(i==7){
					this.txtCode.text=`//设计yoyo时必须先设计repeat,repeat为-1就是无限来回运动
this.tm = new TimelineMax({repeat:-1,yoyo:true});
this.tm.to(this.boxRed,2,{alpha:0,rotation:1080,x:800,scale:2})
`;
				}
			}
			if(i==0||i==6||i==7){
				this.onStart();
			}
		}
		onTimeLine(){
			this.txtCode.text=`//时间线动画不用使用{delay:1}这样的延迟数据，还可以使用开始、停止、暂停、倒放、重新开始等等命令
var tm = new TimelineMax();
this.tm=tm;
tm.to(this.boxRed,2,{x:500});
tm.to(this.boxRed,2,{y:50});
tm.to(this.boxRed,2,{rotation:720});
tm.to(this.boxRed,2,{y:330,ease:Bounce.easeOut});
//tm.repeat(-1);//重复次数
//tm.yoyo(true);//来回运行
`;
		}
		onTimeScale(e){
			if(this.tm){
				this.tm.timeScale(e.detail/50);
			}
		}
		update(){
			this.stage.update();
		}
		onCreateBlue(e){
			if(this.boxBlue)this.stage.removeChild(this.boxBlue);
			this.boxBlue=this.drawBox('#00F');
			this.boxBlue.x=this.boxBlue.y=15;
			this.stage.addChild(this.boxBlue);
			this.stage.update();
		}
		onCreateGreen(e){
			if(this.boxGreen)this.stage.removeChild(this.boxGreen);
			this.boxGreen=this.drawBox('#0F0');
			this.boxGreen.x=15+30;
			this.boxGreen.y=15;
			this.stage.addChild(this.boxGreen);
			this.stage.update();
		}
		initStage(){
			this.stage=new createjs.Stage(this.realityCanvas);
			this.boxRed=this.drawBox('#F00');
			[this.boxRed.x,this.boxRed.y]=[50,150];
			this.boxRed.ox=this.boxRed.x;
			[this.boxRed.ox,this.boxRed.oy]=[this.boxRed.x,this.boxRed.y]
			this.stage.addChild(this.boxRed);
			this.stage.update();
		}
		drawBox(color,w=30,h=30){
			let shape=new createjs.Shape();
			shape.graphics.clear();
			shape.graphics.setStrokeStyle(1);
			shape.graphics.beginStroke("black");
			shape.graphics.beginFill(color).drawRect(-w/2,-h/2,w,h);
			return shape;
		}
	}
	//-----------------文本处理-----------------
	class TextPanel extends BasicPanel{
		constructor(label){
			super(label);		
			let fontSize=20;
			let text=new MoonTextArea(this.p,110,0).setSize(width-215,height-30);
			text.fontSize=fontSize;

			let [x,y]=[5,5];
			new HSlider(this.p,x,y+=30,'字体大小',fontSize, 12, 40,(e)=>{				text.fontSize=e.detail	}).setSize(100);
			let colorFont=new ColorPicker(this.p,x,y+=50,'字体颜色','#000000',(e)=>{	text.color=e.detail		});
			let colorBg=new ColorPicker(this.p,x,y+=50,'背景颜色','#FFFFFF',(e)=>{	 	text.bgColor=e.detail	});
			new Checkbox(this.p,x+20,y+=40,'字体加粗',false,(e)=>{						text.bold=e.detail		});
			let tobNames=['明亮主题','暗黑主题','主题1','主题2','主题3','主题4','主题5','主题6'];
			let g=++group;
			for(let i=0;i<tobNames.length;i++){
				new RadioButton(this.p,x,y+=25,g,tobNames[i],i==0,(e)=>{
					let index=tobNames.indexOf(e.detail);
					console.log(index)
					switch(index){
						case 0:	setColor('#000000','#FFFFFF');	break;
						case 1:	setColor('#cccccc','#000000');	break;
						case 2:	setColor('#57FF60','#004500');	break;
						case 3:	setColor('#FFFFFF','#5B8982');	break;
						case 4:	setColor('#CEC6B6','#45545F');	break;
						case 5:	setColor('#D47655','#E1F8E1');	break;
						case 6:	setColor('#E3927F','#223C5F');	break;
						case 7:	setColor('#F9ECDF','#825855');	break;
						case 8:	setColor('#EDEBE4','#417CA9');	break;
					}
				});
			}
			let tobName2s=['转为大写','转为小写'];
			g=++group;
			for(let i=0;i<tobName2s.length;i++){
				new RadioButton(this.p,x,y+=25,g,tobName2s[i],i==0,(e)=>{
					let index=tobName2s.indexOf(e.detail);
					console.log(index)
					switch(index){
						case 0:	text.text=String(text.text).toLocaleUpperCase();break;
						case 1:	text.text=String(text.text).toLocaleLowerCase();break;
					}
				});
			}
			function setColor(cFont,cBg){
				colorFont.color=cFont;
				colorBg.color=cBg;
				text.color=cFont;
				text.bgColor=cBg;
			}
		}
	}
	//--所有面板----
	var btnNames=['时间转换','生成激活码','各种小工具','颜色选择','制作形状','box2d场景',
	'写写小游戏','自由画图','地图编辑','图片压缩','Tween缓动','文本处理'];
	var buttons=[];
	var currPanelIndex=0;
	var currPanel=null;
	for(var i=0;i<btnNames.length;i++){
		var btn=new Button(panel,2,2+22*i,btnNames[i],onClick);
		buttons.push(btn);
		btn.setSize(88);
		btn.name=i;
	}
	
	function onClick(e){
		let btn=e.target;
		changeView(btn);
	}
	function changeView(btn){
		let name=btn.name;
		buttons.forEach((b)=>{b.enabled=true;});
		btn.enabled=false;
		for(let i=0;i<panels.length;i++){
			panels[i].visible=false;
		}
		currPanel=panels[name]
		currPanel.visible=true;
		currPanel.initData();
		currPanelIndex=name;
		
	}
	
	var panelClass=[[TimePanel,'时间管理大师']
	,[ActiveCodePanel,'激活码制作大师']
	,[MinToolPanel,'各种小工具大师']
	,[CheckDataPanel,'颜色数据大师']
	,[DrawShapePanel,'制作形状大师']
	,[CreateBox2dPanel,'制作box2d场景大师']
	,[WriteJsToolPanel,'在线制作小游戏大师']
	,[DrawToolPanel,'自由画图大师']
	,[MapToolPanel,'地图编辑大师']
	,[ImageToolPanel,'图片压缩大师']
	,[TweenToolPanel,'缓动大师']
	,[TextPanel,'文本大师']
	];
	var panels=[];
	for(let i=0;i<panelClass.length;i++){
		let panel=new panelClass[i][0](panelClass[i][1]);
		panel.visible=false;
		panels.push(panel);
	}
	changeView(buttons[0]);
	//---------
	var y=(btnNames.length+1)*22;
	(new Button(panel,2,y,'打开全屏',()=>setFullScreen(true))).setSize(88);
	(new Button(panel,2,y+22,'关闭全屏',()=>setFullScreen(false))).setSize(88);
	/**设置全屏函数,可根据不同的浏览器使用不同方法*/
	function setFullScreen(boo){
		let doc = document.documentElement;
		if(boo){//开全屏
			if (doc.requestFullscreen) 				doc.requestFullscreen();
		    else if (doc.msRequestFullscreen) 		doc.msRequestFullscreen();
		    else if (doc.mozRequestFullScreen) 		doc.mozRequestFullScreen();
		    else if (doc.webkitRequestFullScreen) 	doc.webkitRequestFullScreen();
		}else{//关全屏
			if (document.exitFullscreen)   				document.exitFullscreen();
		    else if (document.msExitFullscreen)      	document.msExitFullscreen();
		    else if (document.mozCancelFullScreen)      document.mozCancelFullScreen();
		    else if (document.webkitCancelFullScreen) 	document.webkitCancelFullScreen();
		}
	}
	
	</script>
	
	<!--以下是加载文件的处理事件,保存文件处理-->
	<input type="file" onchange="readLocalFile(this)" />
	<script>
	//<input type="file" id="avatar" name="avatar"  accept="image/png, image/jpeg">//加载时只显示图片用
		function readLocalFile(input) {  
            if (window.FileReader) {  
                var file = input.files[0];  
                filename = file.name.split(".")[0];
                var reader = new FileReader();  
                reader.onload = function() {  
                    //console.log(this.result);
					fileContent({data:this.result,file:file});
                }
				//console.log(file.type.split('/')[0]);
				if(file.type.split('/')[0]=='image')reader.readAsDataURL(file);//读取图片
                else								reader.readAsText(file);//读取文本
            }else{ 
                alert('error');   
            }
			
			//console.log(input.value);
			//input.value=null;//设置为null后可以重复加载同一个文件
        } 
		function fileContent(data){
			let panel=panels[currPanelIndex];
			panel.setData(data);
		}
		function download(name, data) {
			var urlObject = window.URL || window.webkitURL || window;
			var downloadData = new Blob([data]);
			var save_link = document.createElementNS("http://www.w3.org/1999/xhtml", "a")
			save_link.href = urlObject.createObjectURL(downloadData);
			save_link.download = name;
			var ev = document.createEvent("MouseEvents");
			ev.initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
			save_link.dispatchEvent(ev);
		}
		//调用方法
		//download("save.txt","内容");
	</script>
	<script>
		//阿拉伯数字转换成大写汉字
		function numberParseChina(money){
			//汉字的数字
			var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
			//基本单位
			var cnIntRadice = new Array('', '拾', '佰', '仟');
			//对应整数部分扩展单位
			var cnIntUnits = new Array('', '万', '亿', '兆');
			//对应小数部分单位
			var cnDecUnits = new Array('角', '分', '毫', '厘');
			//整数金额时后面跟的字符
			var cnInteger = '整';
			//整型完以后的单位
			var cnIntLast = '圆';
			//最大处理的数字
			var maxNum = 999999999999999.9999;
			//金额整数部分
			var integerNum;
			//金额小数部分
			var decimalNum;
			//输出的中文金额字符串
			var chineseStr = '';
			//分离金额后用的数组，预定义
			var parts;
			if (money == '') { return ''; }
			money = parseFloat(money);
			if (money >= maxNum) {
				//超出最大处理数字
				return '';
			}
			if (money == 0) {
				chineseStr = cnNums[0] + cnIntLast + cnInteger;
				return chineseStr;
			}
			//转换为字符串
			money = money.toString();
			if (money.indexOf('.') == -1) {
				integerNum = money;
				decimalNum = '';
			} else {
				parts = money.split('.');
				integerNum = parts[0];
				decimalNum = parts[1].substr(0, 4);
			}
			//获取整型部分转换
			if (parseInt(integerNum, 10) > 0) {
				var zeroCount = 0;
				var IntLen = integerNum.length;
				for (var i = 0; i < IntLen; i++) {
				var n = integerNum.substr(i, 1);
				var p = IntLen - i - 1;
				var q = p / 4;
				var m = p % 4;
				if (n == '0') {
					zeroCount++;
				} else {
					if (zeroCount > 0) {
					chineseStr += cnNums[0];
					}
					//归零
					zeroCount = 0;
					chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
				}
				if (m == 0 && zeroCount < 4) {
					chineseStr += cnIntUnits[q];
				}
				}
				chineseStr += cnIntLast;
			}
			//小数部分
			if (decimalNum != '') {
				var decLen = decimalNum.length;
				for (var i = 0; i < decLen; i++) {
					var n = decimalNum.substr(i, 1);
					if (n != '0') {
						chineseStr += cnNums[Number(n)] + cnDecUnits[i];
					}
				}
			}
			if (chineseStr == '') {
				chineseStr += cnNums[0] + cnIntLast + cnInteger;
			} else if (decimalNum == '') {
				chineseStr += cnInteger;
			}
			return chineseStr;
		}
	</script>
  </body>
</html>